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


Python Ticket.get方法代码示例

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


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

示例1: contribution_detail

# 需要导入模块: from vilya.models.ticket import Ticket [as 别名]
# 或者: from vilya.models.ticket.Ticket import get [as 别名]
 def contribution_detail(self, request):
     req_date = request.get_form_var("date")
     if req_date:
         try:
             req_date = dateutil.parser.parse(req_date).astimezone(dateutil.tz.tzoffset("EST", 8 * 3600))
         except ValueError as e:
             return ""
         contributions = UserContributions.get_by_date(self.name, req_date)
         owned = contributions.get("owned_tickets")
         commented = contributions.get("commented_tickets")
         owned_tickets = filter(None, [Ticket.get(id_) for id_ in owned])
         commented_tickets = filter(None, [Ticket.get(comment[0]) for comment in commented])
         return st("people_contribution_detail.html", **locals())
     return ""
开发者ID:leeccong,项目名称:code,代码行数:16,代码来源:people.py

示例2: main

# 需要导入模块: from vilya.models.ticket import Ticket [as 别名]
# 或者: from vilya.models.ticket.Ticket import get [as 别名]
def main():
    rs = store.execute("select id "
                       "from codedouban_ticket")
    for r in rs:
        id, = r
        ticket = Ticket.get(id)
        # update merge
        pullreq = PullRequest.get_by_ticket(ticket)
        author = pullreq.merge_by or pullreq.to_proj.owner_id
        time = pullreq.merge_time
        ticket_id = ticket.id
        id = 0
        if not get_node(author, TICKET_NODE_TYPE_MERGE, id, ticket_id, time) and time:
            print id, author, time, ticket_id
            store.execute("insert into ticket_nodes "
                          "(author, type, type_id, ticket_id, created_at) "
                          "value (%s, %s, %s, %s, %s)",
                          (author, TICKET_NODE_TYPE_MERGE, id, ticket_id, time))
            store.commit()
        # update close
        author = ticket.close_by or ticket.author
        time = ticket.closed
        ticket_id = ticket.id
        id = 0
        if not get_node(author, TICKET_NODE_TYPE_CLOSE, id, ticket_id, time) and time:
            print id, author, time, ticket_id
            store.execute("insert into ticket_nodes "
                          "(author, type, type_id, ticket_id, created_at) "
                          "value (%s, %s, %s, %s, %s)",
                          (author, TICKET_NODE_TYPE_CLOSE, id, ticket_id, time))
            store.commit()
    print "update %s close & merge pulls" % len(rs)
开发者ID:000fan000,项目名称:code,代码行数:34,代码来源:update_ticket.py

示例3: contribution_detail

# 需要导入模块: from vilya.models.ticket import Ticket [as 别名]
# 或者: from vilya.models.ticket.Ticket import get [as 别名]
 def contribution_detail(self, request):
     req_date = request.get_form_var('date')
     if not req_date:
         return {"error": "No datetime"}
     try:
         req_date = dateutil.parser.parse(req_date).astimezone(
             dateutil.tz.tzoffset('EST', 8 * 3600))
     except ValueError:
         return {"error": "Invalid date"}
     contributions = UserContributions.get_by_date(self.user.name, req_date)
     owned = contributions.get('owned_tickets')
     commented = contributions.get('commented_tickets')
     pullreqs = [Ticket.get(id_).as_dict() for id_ in owned]
     participated = [Ticket.get(comment[0]).as_dict()
                     for comment in commented]
     return {"pull requests": pullreqs,
             "participated": participated}
开发者ID:000fan000,项目名称:code,代码行数:19,代码来源:users.py

示例4: _clean_closed_tickets

# 需要导入模块: from vilya.models.ticket import Ticket [as 别名]
# 或者: from vilya.models.ticket.Ticket import get [as 别名]
 def _clean_closed_tickets(self):
     from vilya.models.ticket import Ticket
     # FIXME should be async function
     tickets = set(self.get_invited() + self.get_participated())
     for ticket_id in tickets:
         t = Ticket.get(ticket_id)
         if t and t.project and not t.closed:
             continue
         self.remove_invited(ticket_id)
         self.remove_participated(ticket_id)
开发者ID:000fan000,项目名称:code,代码行数:12,代码来源:user.py

示例5: test_ticket_close

# 需要导入模块: from vilya.models.ticket import Ticket [as 别名]
# 或者: from vilya.models.ticket.Ticket import get [as 别名]
    def test_ticket_close(self):
        # close ticket
        title = 'test title'
        desc = 'test desc'
        author = 'testuser'

        p2_t1 = Ticket.add(self.proj2.id, title, desc, author)
        pullreq2 = PullRequest.open(
            self.proj2_fork, 'master', self.proj2, 'master')
        pullreq2 = pullreq2.insert(p2_t1.ticket_number)

        assert p2_t1.closed is None
        p2_t1.close('testuser')
        assert Ticket.get(p2_t1.id).closed is not None
开发者ID:leeccong,项目名称:code,代码行数:16,代码来源:test_ticket.py

示例6: gen_telchar_data

# 需要导入模块: from vilya.models.ticket import Ticket [as 别名]
# 或者: from vilya.models.ticket.Ticket import get [as 别名]
def gen_telchar_data(data):
    ticket_id = data.get('ticket_id')
    ticket = Ticket.get(ticket_id)
    pullreq = PullRequest.get_by_proj_and_ticket(
        ticket.project.id, ticket.ticket_id)
    fork_from = pullreq.from_proj.fork_from
    fork_from = pullreq.from_proj.get(fork_from).url if fork_from else None
    return {
        'ticket_id': ticket.ticket_id,
        'fork_from': fork_from,
        'url': pullreq.from_proj.url,
        'to_sha': pullreq.to_sha,
        'from_sha': pullreq.from_sha
    }
开发者ID:000fan000,项目名称:code,代码行数:16,代码来源:pr_actions.py

示例7: test_ticket_update_desc

# 需要导入模块: from vilya.models.ticket import Ticket [as 别名]
# 或者: from vilya.models.ticket.Ticket import get [as 别名]
    def test_ticket_update_desc(self):
        title = 'test title'
        desc = 'test desc'
        author = 'testuser'

        p1_t2 = Ticket.add(self.proj1.id, title, desc, author)
        pullreq = PullRequest.open(
            self.proj1_fork, 'master', self.proj1, 'master')
        pullreq = pullreq.insert(p1_t2.ticket_number)

        new_title = 'this is new title'
        new_desc = 'this is new desc!'
        p1_t2.update(new_title, new_desc)
        p1_t2 = Ticket.get(p1_t2.id)
        assert p1_t2.title == new_title
        assert p1_t2.description == new_desc
开发者ID:leeccong,项目名称:code,代码行数:18,代码来源:test_ticket.py

示例8: after_create

# 需要导入模块: from vilya.models.ticket import Ticket [as 别名]
# 或者: from vilya.models.ticket.Ticket import get [as 别名]
 def after_create(self, extra_args):
     from vilya.models.ticket import Ticket
     comment = self
     TicketNode.add_comment(comment)
     content = extra_args
     bdb.set(BDB_TICKET_COMMENT_CONTENT_KEY % self.id, content)
     ticket = Ticket.get(self.ticket_id)
     # TODO: 将Feed全部迁移到新的系统后,取消signal发送
     codereview_signal.send(comment,
                            content=content,
                            ticket=ticket,
                            author=self.author,
                            comment=comment)
     dispatch('codereview', data={
         'comment': comment,
         'ticket': ticket,
         'sender': self.author,
     })
开发者ID:000fan000,项目名称:code,代码行数:20,代码来源:nticket.py

示例9: add

# 需要导入模块: from vilya.models.ticket import Ticket [as 别名]
# 或者: from vilya.models.ticket.Ticket import get [as 别名]
 def add(cls, target_id, from_sha, to_sha,
         old_path, new_path, from_oid, to_oid, old_linenum, new_linenum,
         author, content):
     # TODO: dispatch 放到 view 里
     from vilya.models.ticket import Ticket
     from vilya.libs.signals import codereview_signal
     from dispatches import dispatch
     comment = super(PullLineComment, cls).add(
         target_id, from_sha, to_sha, old_path, new_path, from_oid,
         to_oid, old_linenum, new_linenum, author, content)
     ticket = Ticket.get(target_id)
     # TODO: 重构feed之后取消signal发送
     if ticket:
         codereview_signal.send(comment, content=content,
                                ticket=ticket,
                                author=author, comment=comment)
         dispatch('codereview', data={
                  'comment': comment,
                  'ticket': ticket,
                  'sender': author,
                  })
     return comment
开发者ID:mozillazg,项目名称:code,代码行数:24,代码来源:linecomment.py

示例10: target

# 需要导入模块: from vilya.models.ticket import Ticket [as 别名]
# 或者: from vilya.models.ticket.Ticket import get [as 别名]
 def target(self):
     from vilya.models.ticket import Ticket
     return Ticket.get(self.target_id)
开发者ID:mozillazg,项目名称:code,代码行数:5,代码来源:linecomment.py

示例11: _q_lookup

# 需要导入模块: from vilya.models.ticket import Ticket [as 别名]
# 或者: from vilya.models.ticket.Ticket import get [as 别名]
def _q_lookup(request, uid):
    if uid.isdigit():
        ticket = Ticket.get(uid)
        if ticket:
            return TicketUI(ticket)
    raise TraversalError
开发者ID:000fan000,项目名称:code,代码行数:8,代码来源:pull.py

示例12: get_participated_pull_requests

# 需要导入模块: from vilya.models.ticket import Ticket [as 别名]
# 或者: from vilya.models.ticket.Ticket import get [as 别名]
 def get_participated_pull_requests(self, is_closed=False):
     from vilya.models.ticket import Ticket
     return [Ticket.get(ticket_id)
             for ticket_id in UserPullRequests(
         self.username).get_participated(is_closed)]
开发者ID:000fan000,项目名称:code,代码行数:7,代码来源:user.py


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