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


Python Info.get_image_store_service方法代码示例

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


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

示例1: _handle_image_delete

# 需要导入模块: from psi.app.service import Info [as 别名]
# 或者: from psi.app.service.Info import get_image_store_service [as 别名]
def _handle_image_delete(mapper, conn, target):
    """
    Delete the local or remote image from 3rd service when delete the image.
    if path is not empty, assume local storage, delete using after_delete
    listener, if public_id is not null, assume using cloud service, delete
    using public_id.
    :param mapper:
    :param conn:
    :param target: image object to be deleted
    :return:
    """
    # TODO.xqliu The delete of image is not working for local image store
    Info.get_image_store_service().remove(target.path, target.public_id)
开发者ID:betterlife,项目名称:psi,代码行数:15,代码来源:image.py

示例2: save_image

# 需要导入模块: from psi.app.service import Info [as 别名]
# 或者: from psi.app.service.Info import get_image_store_service [as 别名]
def save_image(owner, image_file):
    """
    Save image to an owner object
    :param service: The service to save the image,
                    use to isolate different storage service
    :param owner: Owner of this image object
    :param image_file: File storage object of the image
    :return: The image object created
    """
    from psi.app.models import Image
    service = Info.get_image_store_service()
    if owner.image is not None:
        existing_img_public_id = owner.image.path
        service.remove(existing_img_public_id)
    image = Image()
    owner.image = image
    public_id = str(uuid.uuid4())
    result = service.save(image_file, public_id=public_id)
    owner.image.path = result['url']
    owner.image.public_id = public_id
    return image
开发者ID:betterlife,项目名称:psi,代码行数:23,代码来源:file_util.py


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