-
Notifications
You must be signed in to change notification settings - Fork 1
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 permission caching #13
Conversation
eada00b
to
8323ab5
Compare
Pull Request Test Coverage Report for Build 1707619652
💛 - Coveralls |
Pull Request Test Coverage Report for Build 1704251446
💛 - Coveralls |
cache = get_cache() | ||
|
||
if cache: | ||
assert hasattr(request, 'session'), 'The cached permissions requres session middleware to be installed, ' \ |
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.
requires
fperms_iscore/permissions.py
Outdated
assert hasattr(request, 'session'), 'The cached permissions requres session middleware to be installed, ' \ | ||
'and come before the message middleware in the MIDDLEWARE list' | ||
cache_key = f'fperms_is_core-{request.user.pk}-{request.session.session_key}' | ||
cache = caches[settings.IS_CORE_PERM_CACHE_NAME] |
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.
don't you set it already on line 51? what is the difference? 🤔 also unlike the get_cache
function, this doesn't check whether the setting exists
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.
yes this is wrong :)
perm_slugs = None | ||
|
||
if cache: | ||
perm_slugs = cache.get(cache_key) |
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.
can't you move this inside the first if cache:
and perm_slugs = None
before it?
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.
yes thanks
8323ab5
to
4885ac4
Compare
No description provided.