Пример #1
0
 def __call__(self, environ, start_response):
     self.sources.append(environ.get("swift.source"))
     response = self.responses.get_response(environ)
     reason = RESPONSE_REASONS[response.status_int][0]
     start_response("%d %s" % (response.status_int, reason), [(k, v) for k, v in response.headers.items()])
     # It's a bit strange, but the get_info cache stuff relies on the
     # app setting some keys in the environment as it makes requests
     # (in particular GETorHEAD_base) - so our fake does the same
     _set_info_cache(self, environ, response.account, response.container, response)
     if response.obj:
         _set_object_info_cache(self, environ, response.account, response.container, response.obj, response)
     return iter(response.body)
Пример #2
0
 def __call__(self, environ, start_response):
     self.sources.append(environ.get('swift.source'))
     response = self.responses.get_response(environ)
     reason = RESPONSE_REASONS[response.status_int][0]
     start_response('%d %s' % (response.status_int, reason),
                    [(k, v) for k, v in response.headers.items()])
     # It's a bit strange, but the get_info cache stuff relies on the
     # app setting some keys in the environment as it makes requests
     # (in particular GETorHEAD_base) - so our fake does the same
     _set_info_cache(self, environ, response.account, response.container,
                     response)
     if response.obj:
         _set_object_info_cache(self, environ, response.account,
                                response.container, response.obj, response)
     return iter(response.body)