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


Python Issue.get_cached_issue方法代码示例

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


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

示例1: _get_issue_comment_by_uid

# 需要导入模块: from vilya.models.issue import Issue [as 别名]
# 或者: from vilya.models.issue.Issue import get_cached_issue [as 别名]
def _get_issue_comment_by_uid(uid):
    issue = {}
    # uid: issue-type-id-number
    if uid and uid.startswith('issue-'):
        fields = uid.split('-')
        if len(fields) != 6:
            return issue
        _, _, type, id, number, comment_number = fields
        if type == 'project':
            _issue = ProjectIssue.get(id, number=number)
            _issue = Issue.get_cached_issue(_issue.issue_id)
            _target = _get_project_by_name(_issue.target.name)
        elif type == 'team':
            _issue = TeamIssue.get(id, number=number)
            _issue = Issue.get_cached_issue(_issue.issue_id)
            _target = _get_team_by_uid(_issue.target.uid)
        else:
            return issue
    _author = _get_user_by_name(_issue.creator_id)
    _closer = _get_user_by_name(_issue.closer_id) if _issue.closer_id else {}
    issue = dict(
        id=_issue.issue_id,
        name=_issue.title,
        author=_author,
        closer=_closer,
    )
    issue[_issue.target_type] = _target
    return issue
开发者ID:000fan000,项目名称:code,代码行数:30,代码来源:timeline.py

示例2: test_closed_issue_should_not_vote

# 需要导入模块: from vilya.models.issue import Issue [as 别名]
# 或者: from vilya.models.issue.Issue import get_cached_issue [as 别名]
    def test_closed_issue_should_not_vote(self):
        self.test_team_issue.close(self.testuser1)
        self.test_team_issue = Issue.get_cached_issue(
            self.test_team_issue.issue_id)
        count = self.test_team_issue.upvote_by_user(self.testuser2)
        assert count == 0

        self.test_project_issue.close(self.testuser1)
        self.test_project_issue = Issue.get_cached_issue(
            self.test_project_issue.issue_id)
        count = self.test_project_issue.upvote_by_user(self.testuser2)
        assert count == 0
开发者ID:000fan000,项目名称:code,代码行数:14,代码来源:test_issue_upvote.py

示例3: __init__

# 需要导入模块: from vilya.models.issue import Issue [as 别名]
# 或者: from vilya.models.issue.Issue import get_cached_issue [as 别名]
    def __init__(self, issue_id):
        self.target = get_fair()
        self.issue_number = issue_id  # fair issue 直接拿 issue_id 当 number

        self.issue_id = issue_id
        self.issue = Issue.get_cached_issue(issue_id)
        self.issue_template = 'issue/team_issue.html'
开发者ID:leeccong,项目名称:code,代码行数:9,代码来源:fair.py

示例4: get_by_proj_name_and_number

# 需要导入模块: from vilya.models.issue import Issue [as 别名]
# 或者: from vilya.models.issue.Issue import get_cached_issue [as 别名]
    def get_by_proj_name_and_number(cls, proj_name, number):
        from vilya.models.project import CodeDoubanProject

        project = CodeDoubanProject.get_by_name(proj_name)
        project_issue = cls.get(project.id, number=number)
        issue_id = project_issue.issue_id
        return Issue.get_cached_issue(issue_id)
开发者ID:mozillazg,项目名称:code,代码行数:9,代码来源:project_issue.py

示例5: add

# 需要导入模块: from vilya.models.issue import Issue [as 别名]
# 或者: from vilya.models.issue.Issue import get_cached_issue [as 别名]
 def add(
     cls,
     title,
     description,
     creator,
     number=None,
     team=None,
     project=None,
     assignee=None,
     closer=None,
     created_at=None,
     updated_at=None,
     closed_at=None,
 ):
     issue = Issue.add(
         title, description, creator, assignee=assignee, closer=closer, type=cls.target_type, target_id=project
     )
     if issue and project:
         number = PICounter.incr(project, number)
         store.execute(
             "insert into project_issues (project_id, issue_id, number) " "values (%s, %s, %s) ",
             (project, issue.id, number),
         )
         store.commit()
         mc.delete(MC_KEY_PROJECT_ISSUE_CREATOR_N % (project, creator, "open"))
         mc.delete(MC_KEY_PROJECT_ISSUE_CREATOR_N % (project, creator, "closed"))
         cls._clean_cache(project)
         return Issue.get_cached_issue(issue.id)
开发者ID:mozillazg,项目名称:code,代码行数:30,代码来源:project_issue.py

示例6: __init__

# 需要导入模块: from vilya.models.issue import Issue [as 别名]
# 或者: from vilya.models.issue.Issue import get_cached_issue [as 别名]
    def __init__(self, team_uid, issue_number):
        self.target = Team.get_by_uid(team_uid)
        self.issue_number = issue_number

        team_issue = TeamIssue.get(self.target.id, number=self.issue_number)
        self.issue_id = team_issue.issue_id
        self.issue = Issue.get_cached_issue(self.issue_id)
        self.issue_template = "issue/team_issue.html"
开发者ID:leeccong,项目名称:code,代码行数:10,代码来源:team.py

示例7: __init__

# 需要导入模块: from vilya.models.issue import Issue [as 别名]
# 或者: from vilya.models.issue.Issue import get_cached_issue [as 别名]
    def __init__(self, proj_name, issue_number):
        self.target = CodeDoubanProject.get_by_name(proj_name)
        self.issue_number = issue_number

        project_issue = ProjectIssue.get(self.target.id,
                                         number=self.issue_number)
        self.issue_id = project_issue.issue_id
        self.issue = Issue.get_cached_issue(self.issue_id)
        self.issue_template = 'issue/issue.html'
开发者ID:000fan000,项目名称:code,代码行数:11,代码来源:issue.py

示例8: delete

# 需要导入模块: from vilya.models.issue import Issue [as 别名]
# 或者: from vilya.models.issue.Issue import get_cached_issue [as 别名]
 def delete(self, request):
     user = request.user
     if self.comment.author_id != user.username:
         raise AccessError
     issue_id = self.comment.issue_id
     ok = self.comment.delete()
     if not ok:
         return {'r': 0}
     pissue = Issue.get_cached_issue(issue_id)
     pissue.update_rank_score()
     return {'r': 1}
开发者ID:000fan000,项目名称:code,代码行数:13,代码来源:issue.py

示例9: _get_issue_by_project_and_number

# 需要导入模块: from vilya.models.issue import Issue [as 别名]
# 或者: from vilya.models.issue.Issue import get_cached_issue [as 别名]
def _get_issue_by_project_and_number(id, number):
    issue = {}
    project_issue = ProjectIssue.get(id, number=number)
    _issue = Issue.get_cached_issue(project_issue.issue_id)
    _author = _get_user_by_name(_issue.creator_id)
    _closer = _get_user_by_name(_issue.closer_id) if _issue.closer_id else {}
    issue = dict(
        id=_issue.issue_id,
        name=_issue.title,
        author=_author,
        closer=_closer,
    )
    return issue
开发者ID:000fan000,项目名称:code,代码行数:15,代码来源:timeline.py

示例10: test_get_issue

# 需要导入模块: from vilya.models.issue import Issue [as 别名]
# 或者: from vilya.models.issue.Issue import get_cached_issue [as 别名]
    def test_get_issue(self):
        p = ProjectIssue.add('test', 'test description', 'test', project=1)
        r = ProjectIssue.get(p.project_id, issue_id=p.issue_id)
        assert isinstance(r, ProjectIssue)
        assert r.project_id == 1

        r = ProjectIssue.get(p.project_id, number=p.number)
        assert isinstance(r, ProjectIssue)
        assert r.project_id == 1

        r = Issue.get_cached_issue(p.issue_id)
        assert isinstance(r, ProjectIssue)
        assert r.title == 'test'
        assert r.description == 'test description'
        assert r.project_id == 1

        p2 = ProjectIssue.add(
            'test2', 'test2 description', 'test', project=1,
            assignee='assignee')
        p3 = ProjectIssue.add(
            'test3', 'test3 description', 'test', project=1,
            assignee='assignee')
        p4 = ProjectIssue.add(
            'test4', 'test4 description', 'test', project=1, assignee='test')
        p5 = ProjectIssue.add(
            'test5', 'test5 description', 'test1', project=2, assignee='test')

        rs = ProjectIssue._gets_by_project_id(1)
        assert len(rs) == 4

        rs = ProjectIssue._get_issues_by_project_id(1)
        assert all([isinstance(i, ProjectIssue) for i in rs])
        assert len(rs) == 4

        rs = ProjectIssue.gets_by_assignee_id(1, 'assignee')
        assert all([isinstance(i, ProjectIssue) for i in rs])
        assert len(rs) == 2

        rs = ProjectIssue.gets_by_creator_id(1, 'test')
        assert all([isinstance(i, ProjectIssue) for i in rs])
        assert len(rs) == 4

        for p in [p, p2, p3, p4, p5]:
            p.delete()
开发者ID:000fan000,项目名称:code,代码行数:46,代码来源:test_project_issue.py

示例11: patch

# 需要导入模块: from vilya.models.issue import Issue [as 别名]
# 或者: from vilya.models.issue.Issue import get_cached_issue [as 别名]
    def patch(self, request):
        issue = Issue.get_cached_issue(self.project_issue.issue_id)
        if self.user.username != issue.creator_id:
            raise api_errors.NotTheAuthorError('project issue', 'edit')
        data = request.data
        state = data.get("state")
        if state in ("open", "closed") and state != issue.state:
            if state == "open":
                issue.open(self.user.username)
            else:
                issue.close(self.user.username)

        title = data.get("title")
        title = title if title else issue.title
        description = data.get("description")
        description = description if description else issue.description
        issue.update(title, description)
        new_issue = ProjectIssue.get(project_id=self.project.id,
                                     number=self.issue_number)
        return new_issue.as_dict()
开发者ID:000fan000,项目名称:code,代码行数:22,代码来源:issue.py

示例12: get

# 需要导入模块: from vilya.models.issue import Issue [as 别名]
# 或者: from vilya.models.issue.Issue import get_cached_issue [as 别名]
 def get(cls, team_id, issue_id=None, number=None):
     # FIXME: dirty hack. 需要统一子类和基类的get方法
     if number:
         issue_id = number
     return Issue.get_cached_issue(issue_id)
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:fair_issue.py

示例13: issue

# 需要导入模块: from vilya.models.issue import Issue [as 别名]
# 或者: from vilya.models.issue.Issue import get_cached_issue [as 别名]
 def issue(self):
     from vilya.models.issue import Issue
     return Issue.get_cached_issue(self.issue_id)
开发者ID:000fan000,项目名称:code,代码行数:5,代码来源:issue_comment.py


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