mirror of https://github.com/snachodog/mybuddy.git
Only add sessions refresh data to existing sessions
Prior to change session were created for _every_ request (including API requests).
This commit is contained in:
parent
207a5bc236
commit
f29269869c
|
@ -26,12 +26,13 @@ class UserTimezoneMiddleware:
|
||||||
|
|
||||||
class RollingSessionMiddleware:
|
class RollingSessionMiddleware:
|
||||||
"""
|
"""
|
||||||
Periodically resets the session expiry.
|
Periodically resets the session expiry for existing sessions.
|
||||||
"""
|
"""
|
||||||
def __init__(self, get_response):
|
def __init__(self, get_response):
|
||||||
self.get_response = get_response
|
self.get_response = get_response
|
||||||
|
|
||||||
def __call__(self, request):
|
def __call__(self, request):
|
||||||
|
if request.session.keys():
|
||||||
session_refresh = request.session.get('session_refresh')
|
session_refresh = request.session.get('session_refresh')
|
||||||
if session_refresh:
|
if session_refresh:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue