Clean up view-as-call-site #506
Labels
documentation
Things that will improve the understandability and usability of the system for others
enhancement
New feature or request
Expected Behavior
Either calling
view(template=template)
should either result in an error (due totemplate
not being a view restriction), orView
's implicit__str__
behavior should not act the way that it does.Current Behavior
Calling a
View
as a function currently leads to some unexpected behavior, when given an argument other than a filter restriction. For example,{{view.previous(template='foo')}}
just results in the same result asview.previous.link()
, becauseview.previous(template='foo')
is functionally the same asview.previous
(sincetemplate
is not a filter parameter), and then the resulting View object gets__str__
called on it.Possible Solution
Unexpected filter arguments should result in an error, probably.
A possible means of implementing this change would be to change
queries.build_query
to raise aRangeError
for an unknown query parameter, which in turn could be done by changing the logic there to be a foreach that maps to a bunch of lambdas that refine the query (or modify local state for the final filter parameter)Steps to Reproduce (for bugs)
Context
The text was updated successfully, but these errors were encountered: