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


Python Release.author方法代码示例

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


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

示例1: _create_release

# 需要导入模块: from pyshop.models import Release [as 别名]
# 或者: from pyshop.models.Release import author [as 别名]
    def _create_release(self, package, data):

        release = Release(package=package,
                          summary=data.get('summary'),
                          version=data.get('version'),
                          stable_version=data.get('stable_version'),
                          home_page=data.get('home_page'),
                          license=data.get('license'),
                          description=data.get('description'),
                          keywords=data.get('keywords'),
                          platform=data.get('platform'),
                          download_url=data.get('download_url'),
                          bugtrack_url=data.get('bugtrack_url'),
                          docs_url=data.get('docs_url'),
                          )
        if data.get('author'):
            author = User.by_login(self.session, data['author'], local=False)
            if not author:
                author = User(login=data['author'],
                              local=False,
                              email=data.get('author_email'))
                self.session.add(author)
            release.author = author
        self.session.flush()
        if data.get('maintainer'):
            maintainer = User.by_login(self.session, data['maintainer'],
                                       local=False)
            if not maintainer:
                maintainer = User(login=data['maintainer'],
                                  local=False,
                                  email=data.get('maintainer_email'))
                self.session.add(maintainer)
            release.maintainer = maintainer
        self.session.flush()

        for name in data.get('classifiers', []):
            classifier = Classifier.by_name(self.session, name)

            while classifier:
                release.classifiers.append(classifier)
                if classifier not in package.classifiers:
                    package.classifiers.append(classifier)
                classifier = classifier.parent

        self.session.flush()
        return release
开发者ID:disko,项目名称:pyshop,代码行数:48,代码来源:simple.py

示例2: _create_release

# 需要导入模块: from pyshop.models import Release [as 别名]
# 或者: from pyshop.models.Release import author [as 别名]
    def _create_release(self, package, data, session_users):
        log.info('Create release {0} for package {1}'.format(
            data.get('version'), package.name))
        data = self._to_unicode(data)
        release = Release(package=package,
                          summary=data.get('summary'),
                          version=data.get('version'),
                          stable_version=data.get('stable_version'),
                          home_page=data.get('home_page'),
                          license=data.get('license'),
                          description=data.get('description'),
                          keywords=data.get('keywords'),
                          platform=data.get('platform'),
                          download_url=data.get('download_url'),
                          bugtrack_url=data.get('bugtrack_url'),
                          docs_url=data.get('docs_url'),
                          )
        if data.get('author'):
            
            log.info('Looking for author {0}'.format(data['author']))
            if _sanitize(data['author']) in session_users:
                author = session_users[_sanitize(data['author'])]
            else:
                author = User.by_login(self.session, data['author'],
                                       local=False)
            if not author:
                log.info('Author {0} not found, creating'.format(
                    data['author']))
                author = User(login=data['author'],
                              local=False,
                              email=data.get('author_email'))
                self.session.add(author)
                session_users[_sanitize(data['author'])] = author
            release.author = author
            self.session.flush()

        if data.get('maintainer'):
            log.info('Looking for maintainer {0}'.format(data['maintainer']))
            if _sanitize(data['maintainer']) in session_users:
                maintainer = session_users[_sanitize(data['maintainer'])]
            else:
                maintainer = User.by_login(self.session, data['maintainer'],
                                           local=False)
            if not maintainer:
                log.info('Maintainer not found, creating user {0}'
                         ''.format(data['maintainer']))
                maintainer = User(login=data['maintainer'],
                                  local=False,
                                  email=data.get('maintainer_email'))
                self.session.add(maintainer)
                session_users[_sanitize(data['maintainer'])] = maintainer
            release.maintainer = maintainer
            self.session.flush()

        for name in data.get('classifiers', []):
            classifier = Classifier.by_name(self.session, name.decode('utf-8'),
                                            create_if_not_exists=True)

            while classifier:
                if classifier not in release.classifiers:
                    release.classifiers.append(classifier)
                if classifier not in package.classifiers:
                    package.classifiers.append(classifier)
                classifier = classifier.parent

        self.session.flush()
        return release
开发者ID:tvkkpt,项目名称:pyshop,代码行数:69,代码来源:simple.py


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