add matching view name and its args back to plugin.request#109
add matching view name and its args back to plugin.request#109dersphere wants to merge 1 commit intojbeluch:developfrom
Conversation
|
I would write code like this: btw, what's the plugin.request.view? it need type more chars and hidden the real target function name, is it really needed? |
|
The benefit of this PR is that you can finally create reusable pagination (and even view-option-choosing) functions like this: https://github.com/dersphere/JamBMC/blob/master/addon.py#L1066
|
This is more a draft/idea than a full PR.
Problem is, when you have a view with multiple URLs but want to add pagination you need to know the actual views function name and params.
Example code to show the problem:
The views can't be merged to one "multi route view" because the next-page-endpoint is unknown (also it is unknown if the endpoint requires one of the optional kwargs).
Of course in this simple example the code redundancy would not matter, but there are much more complex examples possible. Think about a view which has multiple content altering parameters like "sort_by, sort_order, artist_id, page, ...".
With the change in this PR the views can be merged because the current view (its function name) and its current param-dict is available (for in place patching):