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


Python DepotManager.get_middleware方法代码示例

本文整理汇总了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)
开发者ID:cdevienne,项目名称:depot,代码行数:19,代码来源:thumbnails.py

示例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'])
开发者ID:infobyte,项目名称:faraday,代码行数:7,代码来源:fields.py

示例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()
开发者ID:adamchainz,项目名称:depot,代码行数:4,代码来源:test_depot_manager.py


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