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


Python TicketSystem.get_resource_description方法代码示例

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


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

示例1: ticket_created

# 需要导入模块: from trac.ticket.api import TicketSystem [as 别名]
# 或者: from trac.ticket.api.TicketSystem import get_resource_description [as 别名]
    def ticket_created(self, ticket):
        ticketsystem = TicketSystem(self.env)
        resource_name = get_resource_shortname(self.env, ticket.resource)
        resource_desc = ticketsystem.get_resource_description(ticket.resource,
                                                              format='summary')
        # make sure we will index customerrequest name not id
        cr_id = ticket['customerrequest']
        if cr_id:
            db = self.env.get_read_db()
            cursor = db.cursor()
            cursor.execute("SELECT name FROM public.customer_requests "
                           " WHERE id='%s'" % cr_id)
            row = cursor.fetchone()
            if row:
                ticket.values['customerrequest'] = row[0]

        so = FullTextSearchObject(
                self.project, ticket.resource,
                title = u"%(title)s: %(message)s" % {'title': resource_name,
                                                     'message': resource_desc},
                author = ticket.values.get('reporter'),
                changed = ticket.values.get('changetime'),
                created = ticket.values.get('time'),
                tags = ticket.values.get('keywords'),
                involved = re.split(r'[;,\s]+', ticket.values.get('cc', ''))
                           or ticket.values.get('reporter'),
                popularity = 0, #FIXME
                oneline = shorten_result(ticket.values.get('description', '')),
                body = u'%r' % (ticket.values,),
                status = ticket.values.get('status'),
                comments = [t[4] for t in ticket.get_changelog()],
                )
        self.backend.create(so, quiet=True)
        self._update_ticket(ticket)
        self.log.debug("Ticket added for indexing: %s", ticket)
开发者ID:getpenelope,项目名称:fulltextsearchplugin,代码行数:37,代码来源:fulltextsearch.py

示例2: describe_tagged_resource

# 需要导入模块: from trac.ticket.api import TicketSystem [as 别名]
# 或者: from trac.ticket.api.TicketSystem import get_resource_description [as 别名]
 def describe_tagged_resource(self, req, resource):
     if not self.check_permission(req.perm, 'view'):
         return ''
     ticket = Ticket(self.env, resource.id)
     if ticket.exists:
         # Use the corresponding IResourceManager.
         ticket_system = TicketSystem(self.env)
         return ticket_system.get_resource_description(ticket.resource,
                                                       format='summary')
     else:
         return ''
开发者ID:kzhamaji,项目名称:TracTagsPlugin,代码行数:13,代码来源:ticket.py

示例3: _index_ticket

# 需要导入模块: from trac.ticket.api import TicketSystem [as 别名]
# 或者: from trac.ticket.api.TicketSystem import get_resource_description [as 别名]
 def _index_ticket(self, ticket):
     ticketsystem = TicketSystem(self.env)
     resource_name = get_resource_shortname(self.env, ticket.resource)
     resource_desc = ticketsystem.get_resource_description(ticket.resource, format="summary")
     so = FullTextSearchObject(
         self.project,
         ticket.resource,
         title=u"%(title)s: %(message)s" % {"title": resource_name, "message": resource_desc},
         author=ticket.values.get("reporter"),
         changed=ticket.values.get("changetime"),
         created=ticket.values.get("time"),
         tags=ticket.values.get("keywords"),
         involved=re.split(r"[;,\s]+", ticket.values.get("cc", "")) or ticket.values.get("reporter"),
         popularity=0,  # FIXME
         oneline=shorten_result(ticket.values.get("description", "")),
         body=u"%r" % (ticket.values,),
         comments=[t[4] for t in ticket.get_changelog()],
     )
     self.backend.create(so, quiet=True)
     self.log.debug("Ticket added for indexing: %s", ticket)
开发者ID:CGI-define-and-primeportal,项目名称:trac-plugin-solr,代码行数:22,代码来源:fulltextsearch.py

示例4: ticket_created

# 需要导入模块: from trac.ticket.api import TicketSystem [as 别名]
# 或者: from trac.ticket.api.TicketSystem import get_resource_description [as 别名]
 def ticket_created(self, ticket):
     ticketsystem = TicketSystem(self.env)
     resource_name = get_resource_shortname(self.env, ticket.resource)
     resource_desc = ticketsystem.get_resource_description(ticket.resource,
                                                           format='summary')
     so = FullTextSearchObject(
             self.project, ticket.resource,
             title = u"%(title)s: %(message)s" % {'title': resource_name,
                                                  'message': resource_desc},
             author = ticket.values.get('reporter'),
             changed = ticket.values.get('changetime'),
             created = ticket.values.get('time'),
             tags = ticket.values.get('keywords'),
             involved = re.split(r'[;,\s]+', ticket.values.get('cc', ''))
                        or ticket.values.get('reporter'),
             popularity = 0, #FIXME
             oneline = shorten_result(ticket.values.get('description', '')),
             body = u'%r' % (ticket.values,),
             comments = [t[4] for t in ticket.get_changelog()],
             )
     self.backend.create(so, quiet=True)
     self._update_ticket(ticket)
     self.log.debug("Ticket added for indexing: %s", ticket)
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:25,代码来源:fulltextsearch.py

示例5: get_box

# 需要导入模块: from trac.ticket.api import TicketSystem [as 别名]
# 或者: from trac.ticket.api.TicketSystem import get_resource_description [as 别名]
    def get_box(self, req):
        if req.authname == "anonymous":
            return

        # hoped that ITicketGroupStatsProvider should tell us what the
        # set of "active" statuses, but seems
        # not. DefaultTicketGroupStatsProvider has an idea, from the
        # ini file, but we want to provide new grouping from the
        # LogicaOrderTracker module so it has to be at the interface
        # level rather than component level.
        
        db = self.env.get_read_db()
        cursor = db.cursor()

        counts_ul = tag.ul()
        cursor.execute("""SELECT status, COUNT(status)
                          FROM ticket
                          WHERE owner = %s
                          GROUP BY status
                          ORDER BY 
                            CASE WHEN status = 'assigned'
                              THEN 1
                              ELSE 0
                            END DESC,
                            CASE WHEN status = 'closed'
                              THEN 1
                              ELSE 0
                            END ASC,
                            status ASC""", (req.authname,))
        for status, count in cursor:
            link = tag(tag.span(class_="ticket-state state-" + status), tag.a(status,href=req.href.query(owner=req.authname,
                                                    status=status)))
            counts_ul.append(tag.li(link, ": ", count))


        recent_ul = tag.ul()
        cursor.execute("""SELECT id
                          FROM ticket
                          WHERE ticket.owner = %s
                          GROUP BY id
                          ORDER BY max(changetime) DESC""", 
                       (req.authname,))
        
        shown_count = 0
        ts = TicketSystem(self.env)
        for ticket,  in cursor:
            resource = Resource('ticket', ticket)
            if "TICKET_VIEW" in req.perm(resource):
                shown_count = shown_count + 1
                if shown_count > 5:
                    break
                compact = ts.get_resource_description(resource, 'compact')
                summary = ts.get_resource_description(resource, 'summary')
                link = tag.a(tag.strong(compact), " ", tag.span(summary), href=req.href.ticket(ticket))
                recent_ul.append(tag.li(link))
       

        return tag(
          tag.div(
            tag.h3(
              tag.i(
                class_="fa fa-ticket"
              ),
            " Your Ticket Counts"
            ),
            counts_ul, class_='box-sidebar color-none', id="sidebar-count"
          ),
          tag.div(
            tag.h3(
              tag.i(
                class_="fa fa-star"
              ),
            " Your Recently Modified Tickets"
            ),
            recent_ul, class_='box-sidebar', id="sidebar-recent"
          )
        )
开发者ID:CGI-define-and-primeportal,项目名称:trac-plugin-sidebar,代码行数:79,代码来源:userticketsbox.py


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