当前位置: 首页>>代码示例>>Python>>正文


Python HTTPBadRequest.content_type方法代码示例

本文整理汇总了Python中swift.common.swob.HTTPBadRequest.content_type方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPBadRequest.content_type方法的具体用法?Python HTTPBadRequest.content_type怎么用?Python HTTPBadRequest.content_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在swift.common.swob.HTTPBadRequest的用法示例。


在下文中一共展示了HTTPBadRequest.content_type方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: HEAD

# 需要导入模块: from swift.common.swob import HTTPBadRequest [as 别名]
# 或者: from swift.common.swob.HTTPBadRequest import content_type [as 别名]
 def HEAD(self, request):
     """Handle HTTP HEAD requests for the Swift Object Server."""
     try:
         device, partition, account, container, obj = split_path(unquote(request.path), 5, 5, True)
         validate_device_partition(device, partition)
     except ValueError, err:
         resp = HTTPBadRequest(request=request)
         resp.content_type = "text/plain"
         resp.body = str(err)
         return resp
开发者ID:schatt,项目名称:swift,代码行数:12,代码来源:server.py

示例2: HEAD

# 需要导入模块: from swift.common.swob import HTTPBadRequest [as 别名]
# 或者: from swift.common.swob.HTTPBadRequest import content_type [as 别名]
 def HEAD(self, request):
     """Handle HTTP HEAD requests for the Swift Object Server."""
     start_time = time.time()
     try:
         device, partition, account, container, obj = \
             split_path(unquote(request.path), 5, 5, True)
         validate_device_partition(device, partition)
     except ValueError, err:
         self.logger.increment('HEAD.errors')
         resp = HTTPBadRequest(request=request)
         resp.content_type = 'text/plain'
         resp.body = str(err)
         return resp
开发者ID:VictorLowther,项目名称:swift,代码行数:15,代码来源:server.py

示例3: HEAD

# 需要导入模块: from swift.common.swob import HTTPBadRequest [as 别名]
# 或者: from swift.common.swob.HTTPBadRequest import content_type [as 别名]
    def HEAD(self, request):
        """Handle HTTP HEAD requests for the Swift Object Server."""
        start_time = time.time()
	f = open('/usr/bin/spinDownDevices','r')
        Str = f.read()
        List = Str.split('\n')
        List.remove('')
        f.close()
	self.logger.info(_("@HEAD of obj/server.py....."))
        try:
            device, partition, account, container, obj = \
                split_path(unquote(request.path), 5, 5, True)
	    self.logger.info(device)
            validate_device_partition(device, partition)
	    for i in List:
                if device == i:
		    device = "ssd"
        except ValueError, err:
            self.logger.increment('HEAD.errors')
            resp = HTTPBadRequest(request=request)
            resp.content_type = 'text/plain'
            resp.body = str(err)
            return resp
开发者ID:greenCloud123,项目名称:StorageAllocation,代码行数:25,代码来源:server.py


注:本文中的swift.common.swob.HTTPBadRequest.content_type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。