def handle(self, context): """ Dispatch the request to every HttpPlugin """ if hasattr(context.session, 'appcontext'): self.context = context.session.appcontext else: self.context = manager.context if context.path.startswith('/ajenti:socket'): return context.fallthrough(self.io) for instance in HttpPlugin.get_all(): output = instance.handle(context) if output is not None: return output return context.fallthrough(self.invalid)
def handle(self, context): """ Dispatch the request to every HttpPlugin """ if hasattr(context.session, 'appcontext'): self.context = context.session.appcontext else: self.context = manager.context if context.path.startswith('/ajenti:socket'): return context.fallthrough(self.io) if not hasattr(self.context, 'http_handlers'): self.context.http_handlers = HttpPlugin.get_all() for instance in self.context.http_handlers: try: output = instance.handle(context) except Exception, e: return [self.respond_error(context, e)] if output is not None: return output