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


Python RepositoryManager.close方法代码示例

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


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

示例1: from_comment

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import close [as 别名]
    def from_comment(cls, env, comment, user=None, notify=True):
        """
        Creates a subscription from a Comment object.
        """
        sub = {
            'user': user or comment.author,
            'type': comment.type,
            'notify': notify,
        }

        # Munge attachments
        if comment.type == 'attachment':
            sub['path'] = comment.path.split(':')[1]
            sub['repos'] = ''
            sub['rev'] = ''

        # Munge changesets and browser
        if comment.type in ('changeset', 'browser'):
            if comment.type == 'browser':
                sub['path'] = comment.path
            else:
                sub['path'] = ''
            repo = RepositoryManager(env).get_repository(None)
            try:
                sub['repos'] = repo.reponame
                try:
                    _cs = repo.get_changeset(comment.revision)
                    sub['rev'] = _cs.rev
                except NoSuchChangeset:
                    # Invalid changeset
                    return None
            finally:
                repo.close()

        return cls._from_dict(env, sub)
开发者ID:trainormg,项目名称:trac-code-comments-plugin,代码行数:37,代码来源:subscription.py

示例2: match_request

# 需要导入模块: from trac.versioncontrol import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.RepositoryManager import close [as 别名]
    def match_request(self, request):
        """Match requests which are POST, include a 'commit' argument, and point at an existing repo"""
        if request.method != 'POST':
            return False

        repo_name = _get_repo_name(request.path_info)
        if repo_name is None:
            return False

        repo = RepositoryManager(self.env).get_repository(repo_name)
        if repo is None:
            return False
        repo.close()

        from cgi import parse_qs
        request.args = parse_qs(request.read())
        if request.args.get('commit', request.args.get('payload', None)) is None:
            return False

        ## XXX: evil hack to disable CSRF checking (is there a better way?)
        request._inheaders.insert(0, ('content-type', 'xx'))

        ## Go!
        self.log.info('Handling a beanstalk hook callback for repository [%s]' % repo_name)
        return True
开发者ID:trac-hacks,项目名称:BeanstalkPlugin,代码行数:27,代码来源:BeanstalkPlugin.py


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