在看openstack nova 的代码的时候,看到了这个问题,不知道这个函数代码是什么意思?这个是类作为一个函数的装饰器,是怎么装饰的?
class wsgify(object):
RequestClass = Request def __init__(self, func=None, RequestClass=None, args=(), kwargs=None, middleware_wraps=None): self.func = func if (RequestClass is not None and RequestClass is not self.RequestClass): self.RequestClass = RequestClass self.args = tuple(args) if kwargs is None: kwargs = {} self.kwargs = kwargs self.middleware_wraps = middleware_wraps **@webob.dec.wsgify(RequestClass=wsgi.Request) def __call__(self, req):** if os.path.normpath(req.path_info) == "/": resp = base.ec2_md_print(base.VERSIONS + ["latest"]) req.response.body = resp req.response.content_type = base.MIME_TYPE_TEXT_PLAIN return req.response
请问下这个装饰器是什么意思啊?
The official documentation is here http://docs.webob.org/en/stable/api/dec.html