Ejemplo n.º 1
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        # Clean out any old cookies as they may contain api keys etc
        # This also improves the cachability of our pages as cookies
        # prevent proxy servers from caching content unless they have
        # been configured to ignore them.
        for cookie in request.cookies:
            if cookie.startswith('ckan') and cookie not in ['ckan']:
                response.delete_cookie(cookie)
            # Remove the ckan session cookie if not used e.g. logged out
            elif cookie == 'ckan' and not c.user and not h.are_there_flash_messages(
            ):
                if session.id:
                    if not session.get('lang'):
                        session.delete()
                else:
                    response.delete_cookie(cookie)
            # Remove auth_tkt repoze.who cookie if user not logged in.
            elif cookie == 'auth_tkt' and not session.id:
                response.delete_cookie(cookie)

        try:
            return WSGIController.__call__(self, environ, start_response)
        finally:
            model.Session.remove()
Ejemplo n.º 2
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        # Clean out any old cookies as they may contain api keys etc
        # This also improves the cachability of our pages as cookies
        # prevent proxy servers from caching content unless they have
        # been configured to ignore them.
        for cookie in request.cookies:
            if cookie.startswith("ckan") and cookie not in ["ckan"]:
                response.delete_cookie(cookie)
            # Remove the ckan session cookie if not used e.g. logged out
            elif cookie == "ckan" and not c.user and not h.are_there_flash_messages():
                if session.id:
                    if not session.get("lang"):
                        session.delete()
                else:
                    response.delete_cookie(cookie)
            # Remove auth_tkt repoze.who cookie if user not logged in.
            elif cookie == "auth_tkt" and not session.id:
                response.delete_cookie(cookie)

        try:
            return WSGIController.__call__(self, environ, start_response)
        finally:
            model.Session.remove()
Ejemplo n.º 3
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        # clean out any old cookies as they may contain api keys etc
        for cookie in request.cookies:
            if cookie.startswith('ckan') and cookie not in ['ckan', 'ckan_killtopbar']:
                response.delete_cookie(cookie)

            if cookie == 'ckan' and not c.user and not h.are_there_flash_messages():
                if session.id:
                    if not session.get('lang'):
                        session.delete()
                else:
                    response.delete_cookie(cookie)
        try:
            return WSGIController.__call__(self, environ, start_response)
        finally:
            model.Session.remove()