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


Python Team.get_all_team_uids方法代码示例

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


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

示例1: comment

# 需要导入模块: from vilya.models.team import Team [as 别名]
# 或者: from vilya.models.team.Team import get_all_team_uids [as 别名]
    def comment(self, request):
        target = self.target
        issue = self.issue
        issue_id = self.issue_id
        current_user = request.user

        if request.method == 'POST':
            content = request.get_form_var('content', '').decode('utf-8')
            user = request.user
            user = user.name if user else None
            if user:
                author = user
                if content.strip():
                    comment = issue.add_comment(content, user)
                    issue.add_participant(user)
                    html = st('/widgets/issue/issue_comment.html', **locals())
                else:
                    return {'error': 'Content is empty'}

                if request.get_form_var('comment_and_close'):
                    issue.close(author)
                    # TODO: 重构feed后取消信号发送
                    issue_signal.send(author=author, content=content,
                                      issue_id=issue_id)
                    dispatch('issue', data={
                             'sender': author,
                             'content': content,
                             'issue': issue,
                             })
                    return dict(r=0, reload=1, redirect_to=issue.url)
                elif request.get_form_var('comment_and_open'):
                    issue.open()
                    # TODO: 重构feed后取消信号发送
                    issue_signal.send(author=author, content=content,
                                      issue_id=issue_id)
                    dispatch('issue', data={
                             'sender': author,
                             'content': content,
                             'issue': issue,
                             })
                    return dict(r=0, reload=1, redirect_to=issue.url)
                elif content:
                    issue_comment_signal.send(author=author,
                                              content=comment.content,
                                              issue_id=comment.issue_id,
                                              comment_id=comment.id)
                    dispatch('issue_comment', data={
                             'sender': author,
                             'content': comment.content,
                             'issue': issue,
                             'comment': comment})
                participants = issue.participants

                teams = Team.get_all_team_uids()

                participants_html = st('/widgets/participation.html',
                                       **locals())  # FIXME: locals()?
                return dict(
                    r=0, html=html, participants_html=participants_html)
        return request.redirect(issue.url)
开发者ID:000fan000,项目名称:code,代码行数:62,代码来源:issue.py

示例2: new

# 需要导入模块: from vilya.models.team import Team [as 别名]
# 或者: from vilya.models.team.Team import get_all_team_uids [as 别名]
 def new(self, request):
     project_name = self.proj_name
     project = self.project
     user = request.user
     tags = project.tags
     error = request.get_form_var('error')
     teams = Team.get_all_team_uids()
     return st('issue/new.html', **locals())
开发者ID:000fan000,项目名称:code,代码行数:10,代码来源:issue.py

示例3: new

# 需要导入模块: from vilya.models.team import Team [as 别名]
# 或者: from vilya.models.team.Team import get_all_team_uids [as 别名]
 def new(self, request):
     user = request.user
     current_user = request.user
     team = self.team
     tags = team.tags
     error = request.get_form_var("error")
     teams = Team.get_all_team_uids()
     return st("issue/new_team_issue.html", **locals())
开发者ID:leeccong,项目名称:code,代码行数:10,代码来源:team.py

示例4: new

# 需要导入模块: from vilya.models.team import Team [as 别名]
# 或者: from vilya.models.team.Team import get_all_team_uids [as 别名]
    def new(self, request):
        user = request.user
        if not user:
            raise AccessError
        from_proj = self.project
        from_ref = request.get_form_var('head_ref', from_proj.default_branch)
        parent_proj = from_proj.get_forked_from()
        to_proj = request.get_form_var('base_repo')
        if to_proj:
            to_proj = CodeDoubanProject.get_by_name(to_proj)
        elif parent_proj:
            to_proj = parent_proj
        else:
            to_proj = from_proj
        if not to_proj:
            raise TraversalError("The PR's upstream project is not existed")
        to_ref = request.get_form_var('base_ref', to_proj.default_branch)
        if from_proj != to_proj:
            # Allow to create PR to a different project only if user has push perm
            # ~~A bit weird, maybe should be separate perms
            # ~~If from and to projects are the same, we should be in online edit mode
            if not from_proj.has_push_perm(user.name):
                raise AccessError(
                    "Need push permission to add a PR on another project")
        pullreq = PullRequest.open(from_proj, from_ref, to_proj, to_ref)
        family = from_proj.get_fork_network()
        from_branches = from_proj.repo.branches
        to_branches = to_proj.repo.branches
        from_commit = pullreq.from_commit
        to_commit = pullreq.to_commit
        if not pullreq.can_pull:
            raise TraversalError(
                "The PR's head_ref or base_ref is not existed")
        highlighted_projects = filter(None, [from_proj, parent_proj])
        commits = pullreq.commits
        n_commits = len(commits)
        n_authors = len(set(c.author.username for c in commits))
        ticket_title, ticket_desc = self._choose_default_PR_title_and_description(commits)  # noqa

        # get diff
        diff = pullreq.get_diff(rename_detection=True)
        n_files = diff.length

        grouped_commits = groupby(commits, lambda c: c.author_time.date())

        prs = PullRequest.get_by_from_and_to(
            from_proj.id, from_ref, to_proj.id, to_ref)
        open_pullreqs = []
        for pr in prs:
            t = Ticket.get_by_projectid_and_ticketnumber(
                to_proj.id, pr.ticket_id)
            if t and t.closed is None:
                open_pullreqs.append(pr)
        guideline_url = get_project_guidelines(to_proj)
        teams = Team.get_all_team_uids()
        return st('/pull/new.html', **locals())
开发者ID:000fan000,项目名称:code,代码行数:58,代码来源:pull.py

示例5: join

# 需要导入模块: from vilya.models.team import Team [as 别名]
# 或者: from vilya.models.team.Team import get_all_team_uids [as 别名]
 def join(self, request):
     issue = self.issue
     user = request.user
     if user:
         issue.add_participant(user.name)
         participants = issue.participants
         teams = Team.get_all_team_uids()
         participants_html = st('/widgets/participation.html',
                                participants=participants, teams=teams)
         return dict(r=0, participants_html=participants_html)
     return dict(r=1)
开发者ID:000fan000,项目名称:code,代码行数:13,代码来源:issue.py

示例6: leave

# 需要导入模块: from vilya.models.team import Team [as 别名]
# 或者: from vilya.models.team.Team import get_all_team_uids [as 别名]
 def leave(self, request):
     issue = self.issue
     user = request.user
     if user:
         if user.name == issue.creator_id:
             return dict(r=1, msg="Can't leave the issue created by you.")
         issue.delete_participant(user.name)
         participants = issue.participants
         teams = Team.get_all_team_uids()
         participants_html = st('/widgets/participation.html',
                                participants=participants, teams=teams)
         return dict(r=0, participants_html=participants_html)
     return dict(r=1)
开发者ID:000fan000,项目名称:code,代码行数:15,代码来源:issue.py

示例7: _q_index

# 需要导入模块: from vilya.models.team import Team [as 别名]
# 或者: from vilya.models.team.Team import get_all_team_uids [as 别名]
 def _q_index(self, request):
     show_close = True
     target = self.target
     issue = self.issue
     user = request.user
     current_user = request.user
     author = issue.creator
     i_am_author = user and issue.creator_id == user.username
     i_am_admin = user and target.is_admin(user.name)
     has_user_voted = issue.has_user_voted(user.name) if user else False
     vote_count = issue.vote_count
     teams = Team.get_all_team_uids()
     return st(self.issue_template, **locals())
开发者ID:000fan000,项目名称:code,代码行数:15,代码来源:issue.py

示例8: discussion_tab

# 需要导入模块: from vilya.models.team import Team [as 别名]
# 或者: from vilya.models.team.Team import get_all_team_uids [as 别名]
    def discussion_tab(self, request):
        # TODO: 把 get_diff 提到这里做
        user = request.user
        current_user = request.user
        ticket = self.ticket
        pullreq = self.pullreq
        project = self.project
        has_proj_perm = project.has_push_perm(user.name) if user else False
        show_merge_guide = (
            has_proj_perm or user.username == ticket.author) \
            if user and not ticket.closed else False
        show_close = has_proj_perm or user.name == ticket.author \
            if user and not ticket.closed else False
        show_reopen = has_proj_perm or user.name == ticket.author \
            if user and ticket.closed and not pullreq.merged \
            and not pullreq.is_temp_pull() else False

        # 可以@到team_id
        teams = Team.get_all_team_uids()

        codereviews_group = ticket.get_codereviews_group()
        # 根据 patch(paths, from_sha) 缓存 raw_diff
        raw_diff_by_patch = {}
        key_func = lambda x: x.old_path + x.from_sha
        diff_by_linecomment_id = {}
        for id, linecomments in codereviews_group.iteritems():
            _default = linecomments[0]
            if key_func(_default) in raw_diff_by_patch:
                _diff = pullreq.get_diff(
                    raw_diff=raw_diff_by_patch[key_func(_default)],
                    linecomments=linecomments)
            else:
                _diff = pullreq.get_diff(
                    ref=_default.from_sha, paths=_default.paths,
                    rename_detection=True, linecomments=linecomments)
                if _diff:
                    raw_diff_by_patch[key_func(_default)] = _diff.raw_diff
            diff_by_linecomment_id[_default.id] = _diff

        return st('/pull/ticket_thread.html', **locals())
开发者ID:000fan000,项目名称:code,代码行数:42,代码来源:pull.py


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