Beispiel #1
0
 def _execute(self, transforms, *args, **kwargs):
     ''' select base handler for self '''
     with LogicContext():
         if isinstance(self, WebSocketHandler):
             WebSocketHandler._execute(self, transforms, *args, **kwargs)
         elif isinstance(self, RequestHandler):
             RequestHandler._execute(self, transforms, *args, **kwargs)
Beispiel #2
0
 def _execute(self, transforms, *args, **kwargs):
     ''' select base handler for self '''
     with LogicContext():
         get_context().handler = self
         if isinstance(self, WebSocketHandler):
             WebSocketHandler._execute(self, transforms, *args, **kwargs)
         elif isinstance(self, RequestHandler):
             RequestHandler._execute(self, transforms, *args, **kwargs)
Beispiel #3
0
    def _execute(self, *args, **kwargs):
        """Does the exact same thing like WebSocketHandler._execute() for GET
        requests. Otherwise, acts like RequestHandler.
        """
        if self.request.method == 'GET':
            # dispatch to WebSocketHandler
            WebSocketHandler._execute(self, *args, **kwargs)
        else:
            # remap unsupported WebSocketHandler methods back to RequestHandler
            # the __get__(self, DualHandler) trick is used to bind the methods
            # back to the object, otherwise it's unbound
            for method in ["write", "redirect", "set_header", "send_error",
                           "set_cookie", "set_status", "flush", "finish"]:
                    setattr(self, method,
                            getattr(RequestHandler, method).__get__(
                                    self, DualHandler))
 
            # dispatch to RequestHandler
            RequestHandler._execute(self, *args, **kwargs)
Beispiel #4
0
 def _execute(self, transforms, *args, **kwargs):
     with LogicContext(handler=self):
         if isinstance(self,WebSocketHandler):
             WebSocketHandler._execute(self,transforms, *args, **kwargs)
         elif isinstance(self,RequestHandler):
             RequestHandler._execute(self,transforms, *args, **kwargs)
Beispiel #5
0
 def _execute(self, transforms, *args, **kwargs):
     with LogicContext():
         if isinstance(self, WebSocketHandler):
             WebSocketHandler._execute(self, transforms, *args, **kwargs)
         elif isinstance(self, RequestHandler):
             RequestHandler._execute(self, transforms, *args, **kwargs)
    def _execute(self, transforms, *args, **kwargs):
        if self.request.method.upper() == 'POST':
            self.request.method = self.get_argument('_method', 'POST').upper()

        RequestHandler._execute(self, transforms, *args, **kwargs)