Source

ekkli-maps / common / middleware.py

Full commit
from google.appengine.api import channel


class TokenMiddleWare(object):
    def process_request(self, request):

    #        patterns = ['_ah/','favicon.ico']
    #        for p in patterns:
    #            if p in request.path:
    #                return None

        if not request.is_ajax():
            client_id = request.session.session_key
            token = channel.create_channel(client_id)
            request.token=token

        return None