def operations(*operations):
    '''Decorator for marking Resource methods as HTTP operations.

    This decorator does a number of different things:
        - It transfer onto itself docstring and annotations from the decorated
          method, so as to be "transparent" with regards to introspection.
        - It tranform the method so as to make it a classmethod.
        - It invokes the method within a try-except condition, so as to
          intercept and populate the Fail(<code>) conditions.'''
    def decorator(method):
        def wrapper(cls, request, start_response, **kwargs):
            result_cache = []
            try:
                yield from method(cls, request, **kwargs)
            except Respond as e:
                # Inject messages as taken from signature
                status = e.status
                msg = utils.parse_return_annotation(method)[status]['message']
                if status / 100 == 2:  # All 2xx HTTP codes
                    e.description = msg
                    raise e
                else:  # HTTP Errors --> use werkzeug exceptions
                    raise CODES_TO_EXCEPTIONS[status](msg)
        # Add operation-specific attributes to the method.
        method.swagger_ops = operations
        method.signature = inspect.signature(method)
        method.source = inspect.getsource(method)
        method.path_vars = utils.extract_pathvars(method)
        # "Backport" the method introspective attributes to the wrapper.
        wrapper.__name__ = method.__name__
        wrapper.__doc__ = method.__doc__
        wrapper.__annotations__ = method.__annotations__
        wrapper.swagger_ops = method.swagger_ops
        wrapper.signature = method.signature
        wrapper.source = method.source
        wrapper.path_vars = method.path_vars
        return classmethod(wrapper)
    return decorator
Decorator for marking Resource methods as HTTP operations.

    This decorator does a number of different things:
        - It transfer onto itself docstring and annotations from the decorated
          method, so as to be "transparent" with regards to introspection.
        - It tranform the method so as to make it a classmethod.
        - It invokes the method within a try-except condition, so as to
          intercept and populate the Fail(<code>) conditions.