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

Add new "uses" parameter to ActionFactory methods, allowing additional fixtures to be provided for specific controllers #946

Merged
merged 4 commits into from
Nov 21, 2024

Conversation

laundmo
Copy link
Contributor

@laundmo laundmo commented Nov 14, 2024

This PR adds a new arguments to ActionFactory.__call__ and the individual HTTP method calls.

It also improves documentation for ActionFactory/convenience decorators.

Motivation:
The convenience decorators, while nice, were previously quite limiting. Users had to either create a new convenience decorator for every combination of fixtures or avoid using them entirely. For example, checking groups permissions with a fixture like the docs recommend was a hassle to do, as it would require an ActionFactory instance per group.

This allows the following to work:

@authenticated(uses=[requires_group("admin")])
def admin_dashboard():
    return dict()

or alternatively using HTTP method specific calls

@authenticated.get(uses=[requires_group("admin")])
def admin_dashboard():
    return dict()

Laurin Schmidt added 4 commits November 14, 2024 15:26
"It is not possible to re-include a file if a parent directory of that file is excluded." caused the !apps/... re-includes not to work
@mdipierro mdipierro merged commit 3752e12 into web2py:master Nov 21, 2024
7 checks passed
@laundmo laundmo deleted the extra_action_factory_uses branch January 28, 2025 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants