-
Notifications
You must be signed in to change notification settings - Fork 134
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
Make permissions in dynamic item lazy evaluated #303
Conversation
cleaned_permissions.append(perm) | ||
|
||
item_obj.permissions = cleaned_permissions or [] | ||
item_obj.permissions = SimpleLazyObject(lambda: clean_permissions(access_by_perms)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps is better to return a SimpleLazyObject
from within clean_permissions
. The string parsing/checking etc. isn't a heavy calculation so can happen right away (with the advantage of having feedback directly when starting the server).
The only contents of the SimpleLazyObject would be these lines: https://github.com/idlesign/django-sitetree/pull/303/files#diff-ccaf61b8a24236aa8dced71a05c2fe1f8b811e09ee8e1b14ca2c71eabc6d82ecR64-R67
I also created two alternatives solutions (see fluxility@af46e52 and fluxility@3386ef7). Please let me know if you prefer one of the other solutions better. |
Thank you. |
I'd like to ask you to rebase on current master where the proper CI Action is in place. |
This fixes idlesign#302. By adding lazy evaluation for the permissions we prevent manage.py breaking down when using dynamic items with permissions in an AppConfig.ready().
Thank you. Merged. |
This fixes #302. By adding lazy evaluation for the permissions we prevent
manage.py breaking down when using dynamic items with permissions in an
AppConfig.ready().