Skip to content
Myr

Added total_seconds() helper for pythons before 2.7

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 7f87091 · Browse files · 1 file+5 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−1 removed

  • other:+5 added−1 removed

1 file+5 added−1 removed

modified:flask/sessions.py+5 added-1 removed
17 unmodified lines
1819from itsdangerous import URLSafeTimedSerializer, BadSignature202122def total_seconds(td):23 return td.days * 60 * 60 * 24 + td.seconds242526class SessionMixin(object):27 """Expands a basic dictionary with an accessors that are expected28 by Flask extensions and users for the session.29 """
240 unmodified lines
270 return None271 val = request.cookies.get(app.session_cookie_name)272 if not val:273 return self.session_class()270 max_age = app.permanent_session_lifetime.total_seconds()274 max_age = total_seconds(app.permanent_session_lifetime)275 try:276 data = s.loads(val, max_age=max_age)277 return self.session_class(data)278 except BadSignature:
17 unmodified lines