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


Python Release.by_id方法代码示例

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


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

示例1: show_external_release_file

# 需要导入模块: from pyshop.models import Release [as 别名]
# 或者: from pyshop.models.Release import by_id [as 别名]
def show_external_release_file(root, request):
    """
    Download a release from a download url from its package information.
    Must be used with :func:`pyshop.helpers.download.renderer_factory`
    to download the release file.

    :return: download informations
    :rtype: dict
    """
    session = DBSession()

    settings = request.registry.settings
    whlify = asbool(settings.get('pyshop.mirror.wheelify', '0'))
    release = Release.by_id(session, int(request.matchdict['release_id']))

    filename = (release.whlify_download_url_file if whlify else
                release.download_url_file)

    rv = {'url': release.download_url,
          'filename': filename,
          'original': release.download_url_file,
          'whlify': whlify
          }

    release.downloads += 1
    release.package.downloads += 1
    session.add(release.package)
    session.add(release)
    request.response.date = datetime.datetime.utcnow()
    return rv
开发者ID:EasyPost,项目名称:pyshop,代码行数:32,代码来源:repository.py

示例2: show_external_release_file

# 需要导入模块: from pyshop.models import Release [as 别名]
# 或者: from pyshop.models.Release import by_id [as 别名]
def show_external_release_file(root, request):
    """
    Download a release from a download url from its package information.
    Must be used with :func:`pyshop.helpers.download.renderer_factory`
    to download the release file.

    :return: download informations
    :rtype: dict
    """
    session = DBSession()

    release = Release.by_id(session, int(request.matchdict['release_id']))

    rv = {'url': release.download_url,
          'filename': release.download_url_file,
          }

    release.downloads += 1
    release.package.downloads += 1
    session.add(release.package)
    session.add(release)
    return rv
开发者ID:vickyi,项目名称:pyshop,代码行数:24,代码来源:repository.py


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