예제 #1
0
    def __after__(self):
        db.session.close()
        response.pragma = None

        if not app_globals.cache_enabled or 'flash' in session._session():
            return

        if c._cache_disabled:
            return

        del response.cache_control.no_cache
        if len(session._session().keys()) == 2 and \
                not len(request.cookies.keys()):
            session._current_obj().__dict__['_sess'] = None
            response.cache_control.public = True
        else:
            response.cache_control.private = True

        # Set vary header (this will set Cookie as a value for the vary header
        # so different content can be served to logged in users
        set_vary_header()

        response.cache_control.must_revalidate = c._must_revalidate
        if not c._must_revalidate:
            response.cache_control.max_age = 3600 * 6
예제 #2
0
    def __after__(self):
        db.session.close()
        response.pragma = None

        if not app_globals.cache_enabled or 'flash' in session._session():
            return

        if c._cache_disabled:
            return

        del response.cache_control.no_cache
        if len(session._session().keys()) == 2 and not len(request.cookies.keys()):
            session._current_obj().__dict__['_sess'] = None
            response.cache_control.public = True
        else:
            response.cache_control.private = True

        response.cache_control.must_revalidate = c._must_revalidate
        if not c._must_revalidate:
            response.cache_control.max_age = 3600 * 6
            response.expires = datetime.utcnow() + \
                timedelta(seconds=response.cache_control.max_age)
예제 #3
0
    def __after__(self):
        db.session.close()
        response.pragma = None

        if not app_globals.cache_enabled or 'flash' in session._session():
            return

        if c._cache_disabled:
            return

        del response.cache_control.no_cache
        if len(session._session().keys()) == 2 and not len(
                request.cookies.keys()):
            session._current_obj().__dict__['_sess'] = None
            response.cache_control.public = True
        else:
            response.cache_control.private = True

        response.cache_control.must_revalidate = c._must_revalidate
        if not c._must_revalidate:
            response.cache_control.max_age = 3600 * 6
            response.expires = datetime.utcnow() + \
                timedelta(seconds=response.cache_control.max_age)