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


Python Ticket.gets_by_projectid_and_ticketnumbers方法代码示例

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


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

示例1: search

# 需要导入模块: from vilya.models.ticket import Ticket [as 别名]
# 或者: from vilya.models.ticket.Ticket import gets_by_projectid_and_ticketnumbers [as 别名]
 def search(self, request):
     key_word = request.get_form_var('q')
     if not key_word:
         return self._index(request)
     status = request.get_form_var('status')
     user = request.user
     page = request.get_form_var('page', 1)
     project = self.project
     tickets = []
     ticket_len = Ticket.get_count_by_proj_id(project.id)
     search_result = PullRequestSearch.search_a_phrase(
         key_word, project.id, size=ticket_len)
     if search_result and not search_result.get('error'):
         ticket_ids = [id for id, in SearchEngine.decode(
             search_result, ['ticket_id'])]
         tickets = Ticket.gets_by_projectid_and_ticketnumbers(
             project.id, ticket_ids)
         if status == "closed":
             tickets = [t for t in tickets if t.closed]
         else:
             tickets = [t for t in tickets if not t.closed]
     ticket_total_len = len(tickets)
     limit = TICKETS_COUNT_PER_PAGE
     start = TICKETS_COUNT_PER_PAGE * (int(page) - 1)
     tickets = tickets[start:start + limit]
     n_pages = (ticket_total_len - 1) / TICKETS_COUNT_PER_PAGE + 1
     if status == "closed":
         is_closed_tab = True
     else:
         is_closed_tab = False
     open_tab_link = self.open_tab_link
     close_tab_link = self.close_tab_link
     return st('/pull/pulls.html', **locals())
开发者ID:000fan000,项目名称:code,代码行数:35,代码来源:pull.py


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