Python flask.helpers.total_seconds() Examples

The following are 6 code examples of flask.helpers.total_seconds(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module flask.helpers , or try the search function .
Example #1
Source File: sessions.py    From recruit with Apache License 2.0 5 votes vote down vote up
def open_session(self, app, request):
        s = self.get_signing_serializer(app)
        if s is None:
            return None
        val = request.cookies.get(app.session_cookie_name)
        if not val:
            return self.session_class()
        max_age = total_seconds(app.permanent_session_lifetime)
        try:
            data = s.loads(val, max_age=max_age)
            return self.session_class(data)
        except BadSignature:
            return self.session_class() 
Example #2
Source File: static.py    From freight with Apache License 2.0 5 votes vote down vote up
def __init__(self, root, cache_timeout=0):
        self.root = root
        self.cache_timeout = total_seconds(app.config["SEND_FILE_MAX_AGE_DEFAULT"]) 
Example #3
Source File: sessions.py    From Building-Recommendation-Systems-with-Python with MIT License 5 votes vote down vote up
def open_session(self, app, request):
        s = self.get_signing_serializer(app)
        if s is None:
            return None
        val = request.cookies.get(app.session_cookie_name)
        if not val:
            return self.session_class()
        max_age = total_seconds(app.permanent_session_lifetime)
        try:
            data = s.loads(val, max_age=max_age)
            return self.session_class(data)
        except BadSignature:
            return self.session_class() 
Example #4
Source File: sessions.py    From Building-Recommendation-Systems-with-Python with MIT License 5 votes vote down vote up
def open_session(self, app, request):
        s = self.get_signing_serializer(app)
        if s is None:
            return None
        val = request.cookies.get(app.session_cookie_name)
        if not val:
            return self.session_class()
        max_age = total_seconds(app.permanent_session_lifetime)
        try:
            data = s.loads(val, max_age=max_age)
            return self.session_class(data)
        except BadSignature:
            return self.session_class() 
Example #5
Source File: sessions.py    From scylla with Apache License 2.0 5 votes vote down vote up
def open_session(self, app, request):
        s = self.get_signing_serializer(app)
        if s is None:
            return None
        val = request.cookies.get(app.session_cookie_name)
        if not val:
            return self.session_class()
        max_age = total_seconds(app.permanent_session_lifetime)
        try:
            data = s.loads(val, max_age=max_age)
            return self.session_class(data)
        except BadSignature:
            return self.session_class() 
Example #6
Source File: sessions.py    From android_universal with MIT License 5 votes vote down vote up
def open_session(self, app, request):
        s = self.get_signing_serializer(app)
        if s is None:
            return None
        val = request.cookies.get(app.session_cookie_name)
        if not val:
            return self.session_class()
        max_age = total_seconds(app.permanent_session_lifetime)
        try:
            data = s.loads(val, max_age=max_age)
            return self.session_class(data)
        except BadSignature:
            return self.session_class()