Ejemplo n.º 1
0
 def destroy_context(self):
     destroy_context()
Ejemplo n.º 2
0
 def destroy_context(self):
     destroy_context()
Ejemplo n.º 3
0
                fallback=self.env.fallback, delegate=self.env.delegate)
        if client_ip is not None:
            setattr(context, "client_ip", client_ip)

    def destroy_context(self):
        destroy_context()

    def execute(self, _name, *args, **options):
        error = None
        try:
            if _name not in self.Command:
                raise CommandError(name=_name)
            result = self.Command[_name](*args, **options)
        except PublicError, e:
            error = e
        except StandardError, e:
            self.exception(
                'non-public: %s: %s', e.__class__.__name__, str(e)
            )
            error = InternalError()
        except Exception, e:
            self.exception(
                'unhandled exception: %s: %s', e.__class__.__name__, str(e)
            )
            error = InternalError()
        destroy_context()
        if error is None:
            return result
        assert isinstance(error, PublicError)
        raise error #pylint: disable=E0702
Ejemplo n.º 4
0
                fallback=self.env.fallback, delegate=self.env.delegate)
        if client_ip is not None:
            setattr(context, "client_ip", client_ip)

    def destroy_context(self):
        destroy_context()

    def execute(self, _name, *args, **options):
        error = None
        try:
            if _name not in self.Command:
                raise CommandError(name=_name)
            result = self.Command[_name](*args, **options)
        except PublicError, e:
            error = e
        except StandardError, e:
            self.exception(
                'non-public: %s: %s', e.__class__.__name__, str(e)
            )
            error = InternalError()
        except Exception, e:
            self.exception(
                'unhandled exception: %s: %s', e.__class__.__name__, str(e)
            )
            error = InternalError()
        destroy_context()
        if error is None:
            return result
        assert isinstance(error, PublicError)
        raise error #pylint: disable=E0702