本文整理汇总了Python中depot.manager.DepotManager.get_middleware方法的典型用法代码示例。如果您正苦于以下问题:Python DepotManager.get_middleware方法的具体用法?Python DepotManager.get_middleware怎么用?Python DepotManager.get_middleware使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类depot.manager.DepotManager
的用法示例。
在下文中一共展示了DepotManager.get_middleware方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_save
# 需要导入模块: from depot.manager import DepotManager [as 别名]
# 或者: from depot.manager.DepotManager import get_middleware [as 别名]
def on_save(self, uploaded_file):
content = utils.file_from_content(uploaded_file.original_content)
thumbnail = Image.open(content)
thumbnail.thumbnail(self.thumbnail_size, Image.BILINEAR)
thumbnail = thumbnail.convert('RGBA')
thumbnail.format = self.thumbnail_format
output = BytesIO()
thumbnail.save(output, self.thumbnail_format)
output.seek(0)
thumb_file_name = 'thumb.%s' % self.thumbnail_format.lower()
thumb_path, thumb_id = uploaded_file.store_content(output, thumb_file_name)
uploaded_file['thumb_id'] = thumb_id
uploaded_file['thumb_path'] = thumb_path
uploaded_file['thumb_url'] = DepotManager.get_middleware().url_for(thumb_path)
示例2: thumb_url
# 需要导入模块: from depot.manager import DepotManager [as 别名]
# 或者: from depot.manager.DepotManager import get_middleware [as 别名]
def thumb_url(self):
public_url = self['_thumb_public_url']
if public_url:
return public_url
return DepotManager.get_middleware().url_for(self['thumb_path'])
示例3: test_detects_no_middleware
# 需要导入模块: from depot.manager import DepotManager [as 别名]
# 或者: from depot.manager.DepotManager import get_middleware [as 别名]
def test_detects_no_middleware(self):
DepotManager.get_middleware()