Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up view-as-call-site #506

Closed
fluffy-critter opened this issue Dec 26, 2022 · 0 comments · Fixed by #507
Closed

Clean up view-as-call-site #506

fluffy-critter opened this issue Dec 26, 2022 · 0 comments · Fixed by #507
Labels
documentation Things that will improve the understandability and usability of the system for others enhancement New feature or request

Comments

@fluffy-critter
Copy link
Collaborator

fluffy-critter commented Dec 26, 2022

Expected Behavior

Either calling view(template=template) should either result in an error (due to template not being a view restriction), or View'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 as view.previous.link(), because view.previous(template='foo') is functionally the same as view.previous (since template 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 a RangeError 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

@fluffy-critter fluffy-critter added enhancement New feature or request documentation Things that will improve the understandability and usability of the system for others labels Dec 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Things that will improve the understandability and usability of the system for others enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant