def pre(self):
        BaseController.pre(self)

        action = request.environ["pylons.routes_dict"].get("action")
        if action:
            if not self._get_action_handler():
                action = 'invalid'
            controller = request.environ["pylons.routes_dict"]["controller"]
            timer_name = "service_time.web.{}.{}".format(controller, action)
            c.request_timer = g.stats.get_timer(timer_name)
        else:
            c.request_timer = SimpleSillyStub()

        c.request_timer.start()

        if "Origin" in request.headers:
            oauth_origin = "https://%s" % g.oauth_domain
            response.headers["Access-Control-Allow-Origin"] = oauth_origin
            response.headers["Vary"] = "Origin"
            response.headers["Access-Control-Allow-Methods"] = "GET"
            response.headers["Access-Control-Allow-Credentials"] = "true"
예제 #2
0
 def pre(self, *k, **kw):
     BaseController.pre(self, *k, **kw)
     c.extension = request.environ.get('extension')
예제 #3
0
파일: redirect.py 프로젝트: pra85/reddit
 def pre(self, *k, **kw):
     BaseController.pre(self, *k, **kw)
     c.extension = request.environ.get('extension')