本文整理汇总了Python中swift.common.swob.Request.path方法的典型用法代码示例。如果您正苦于以下问题:Python Request.path方法的具体用法?Python Request.path怎么用?Python Request.path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类swift.common.swob.Request
的用法示例。
在下文中一共展示了Request.path方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __call__
# 需要导入模块: from swift.common.swob import Request [as 别名]
# 或者: from swift.common.swob.Request import path [as 别名]
def __call__(self, env, start_response):
req = Request(env)
try:
requestMethod = env['REQUEST_METHOD']
if requestMethod == 'DELETE':
def delete_start_response(status, headers):
if '204' in status:
self.DELETE(env)
return start_response(status, headers)
return self.app(env, delete_start_response)
if requestMethod == 'POST':
def post_start_response(status, headers):
if '204' in status:
self.POST(env)
return start_response(status, headers)
return self.app(env, post_start_response)
if (requestMethod == 'PUT') and ('X-Copy-From' in req.headers):
#Modify the PUT to be a COPY for seamless operation
v, a, c, o = split_path(req.path, 1, 4, True)
req.path = ('/' + '/'.join([v,a]) + req.headers['X-Copy-From'])
req.headers['Destination'] = '/'.join([c,o])
requestMethod = 'COPY'
if requestMethod == 'COPY':
def copy_start_response(status, headers):
if '201' in status:
self.COPY(env)
return start_response(status, headers)
return self.app(env, copy_start_response)
if requestMethod == 'PUT':
def put_start_response(status, headers):
if ('201' in status) or ('202' in status):
self.PUT(env)
return start_response(status, headers)
return self.app(env, put_start_response)
if 'metadata' in req.params:
if self.versioncheck(req.params['metadata']):
handler = self.GET
return handler(req)(env, start_response)
elif req.params['metadata'] == 'services':
handler = self.SERVICES
return handler(req)(env, start_response)
else:
handler = self.BAD
return handler(req)(env, start_response)
except UnicodeError:
pass
return self.app(env, start_response)