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 permission caching #13

Merged
merged 1 commit into from
Jan 18, 2022
Merged

Add permission caching #13

merged 1 commit into from
Jan 18, 2022

Conversation

matllubos
Copy link
Collaborator

No description provided.

@coveralls
Copy link

coveralls commented Jan 16, 2022

Pull Request Test Coverage Report for Build 1707619652

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 0.0%

Totals Coverage Status
Change from base Build 1583141648: 0.0%
Covered Lines: 0
Relevant Lines: 0

💛 - Coveralls

@coveralls
Copy link

Pull Request Test Coverage Report for Build 1704251446

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 0.0%

Totals Coverage Status
Change from base Build 1583141648: 0.0%
Covered Lines: 0
Relevant Lines: 0

💛 - Coveralls

cache = get_cache()

if cache:
assert hasattr(request, 'session'), 'The cached permissions requres session middleware to be installed, ' \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requires

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]

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

Copy link
Collaborator Author

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)

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants