-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix reset SessioTokenFilter on /api/iniconfig request when QDJANGO_PR…
…J_CACHE = True
- Loading branch information
wlorenzetti
committed
Nov 15, 2024
1 parent
aafff46
commit f777048
Showing
4 changed files
with
39 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# coding=utf-8 | ||
"""" Utility function for session | ||
.. note:: This program is free software; you can redistribute it and/or modify | ||
it under the terms of the Mozilla Public License 2.0. | ||
""" | ||
|
||
__author__ = '[email protected]' | ||
__date__ = '2024-11-15' | ||
__copyright__ = 'Copyright 2015 - 2024, Gis3w' | ||
__license__ = 'MPL 2.0' | ||
|
||
from django.conf import settings | ||
from qdjango.models import SessionTokenFilter | ||
|
||
def reset_filtertoken(request): | ||
""" | ||
Check session token filter ad delete it | ||
:param request: Django request object | ||
""" | ||
|
||
try: | ||
if settings.SESSION_COOKIE_NAME in request.COOKIES: | ||
stf = SessionTokenFilter.objects.get( | ||
sessionid=request.COOKIES[settings.SESSION_COOKIE_NAME]) | ||
stf.delete() | ||
except AttributeError: | ||
return None | ||
except SessionTokenFilter.DoesNotExist: | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters