• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python model.Ticket类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中trac.ticket.model.Ticket的典型用法代码示例。如果您正苦于以下问题:Python Ticket类的具体用法?Python Ticket怎么用?Python Ticket使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: test_email_map

 def test_email_map(self):
     """Login-to-email mapping"""
     self.env.config.set("notification", "always_notify_owner", "true")
     self.env.config.set("notification", "always_notify_reporter", "true")
     self.env.config.set("notification", "smtp_always_cc", "[email protected]")
     self.env.known_users = [
         ("joeuser", "Joe User", "[email protected]"),
         ("[email protected]", "Jim User", "[email protected]"),
     ]
     ticket = Ticket(self.env)
     ticket["reporter"] = "joeuser"
     ticket["owner"] = "[email protected]"
     ticket["summary"] = "This is a summary"
     ticket.insert()
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=True)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
     # Msg should always have a 'To' field
     self.failIf("To" not in headers)
     tolist = [addr.strip() for addr in headers["To"].split(",")]
     # 'To' list should have been resolved to the real email address
     self.failIf("[email protected]" not in tolist)
     self.failIf("[email protected]" not in tolist)
     self.failIf("joeuser" in tolist)
     self.failIf("[email protected]" in tolist)
开发者ID:moreati,项目名称:trac-gitsvn,代码行数:26,代码来源:notification.py


示例2: _test_updater

 def _test_updater(disable):
     if disable:
         self.env.config.set('notification','always_notify_updater',
                             'false')
     ticket = Ticket(self.env)
     ticket['reporter'] = '[email protected]'
     ticket['summary'] = u'This is a súmmäry'
     ticket['cc'] = '[email protected]'
     ticket.insert()
     ticket['component'] = 'dummy'
     now = time.time()
     ticket.save_changes('[email protected]', 'This is a change',
                         when=now)
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=False, modtime=now)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
     # checks for header existence
     self.failIf(not headers)
     # checks for updater in the 'To' recipient list
     self.failIf('To' not in headers)
     tolist = [addr.strip() for addr in headers['To'].split(',')]
     if disable:
         self.failIf('[email protected]' in tolist)
     else:
         self.failIf('[email protected]' not in tolist)
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:26,代码来源:notification.py


示例3: test_get_tickets

    def test_get_tickets(self):
        for pdata in (
            {'prefix': 'p2', 'name':'product, too', 'description': ''},
            {'prefix': 'p3', 'name':'strike three', 'description': ''},
        ):
            num_tickets = 5
            product = Product(self.global_env)
            product._data.update(pdata)
            product.insert()
            self.env = ProductEnvironment(self.global_env, product)
            for i in range(num_tickets):
                ticket = Ticket(self.env)
                ticket['summary'] = 'hello ticket #%s-%d' % (product.prefix, i)
                ticket['reporter'] = 'admin'
                tid = ticket.insert()

            # retrieve tickets using both global and product scope
            tickets_from_global = [(t['product'], t['id']) for t in
                Product.get_tickets(self.global_env, product.prefix)]
            self.assertEqual(len(tickets_from_global), num_tickets)
            tickets_from_product = [(t['product'], t['id']) for t in
                Product.get_tickets(self.env)]
            self.assertEqual(len(tickets_from_product), num_tickets)
            # both lists should contain same elements
            intersection = set(tickets_from_global) & set(tickets_from_product)
            self.assertEqual(len(intersection), num_tickets)
开发者ID:mohsadki,项目名称:dargest,代码行数:26,代码来源:model.py


示例4: ticket_setup

def ticket_setup(tc):
    ticket = Ticket(tc.env)
    ticket['reporter'] = 'santa'
    ticket['summary'] = 'This is the summary'
    ticket.insert()
    ticket['status'] = 'new'
    ticket.save_changes('claus', 'set status', 0)
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:7,代码来源:wikisyntax.py


示例5: _test_short_login

 def _test_short_login(enabled):
     ticket = Ticket(self.env)
     ticket['reporter'] = 'joeuser'
     ticket['summary'] = 'This is a summary'
     ticket.insert()
     # Be sure that at least one email address is valid, so that we 
     # send a notification even if other addresses are not valid
     self.env.config.set('notification', 'smtp_always_cc',
                         '[email protected]')
     if enabled:
         self.env.config.set('notification', 'use_short_addr', 'true')
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=True)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
     # Msg should not have a 'To' header
     if not enabled:
         self.failIf('To' in headers)
     else:
         tolist = [addr.strip() for addr in headers['To'].split(',')]
     # Msg should have a 'Cc' field
     self.failIf('Cc' not in headers)
     cclist = [addr.strip() for addr in headers['Cc'].split(',')]
     if enabled:
         # Msg should be delivered to the reporter
         self.failIf(ticket['reporter'] not in tolist)
     else:
         # Msg should not be delivered to joeuser
         self.failIf(ticket['reporter'] in cclist)
     # Msg should still be delivered to the always_cc list
     self.failIf(self.env.config.get('notification',
                 'smtp_always_cc') not in cclist)
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:32,代码来源:notification.py


示例6: create

    def create(self, req, summary, description, attributes={}, notify=False):
        """ Create a new ticket, returning the ticket ID.

        PS: Borrowed from XmlRpcPlugin.
        """
        if 'product' in attributes:
            env = self.env.parent or self.env
            if attributes['product']:
                env = ProductEnvironment(env, attributes['product'])
        else:
            env = self.env

        t = Ticket(env)
        t['summary'] = summary
        t['description'] = description
        t['reporter'] = req.authname
        for k, v in attributes.iteritems():
            t[k] = v
        t['status'] = 'new'
        t['resolution'] = ''
        t.insert()

        if notify:
            try:
                tn = TicketNotifyEmail(env)
                tn.notify(t, newticket=True)
            except Exception, e:
                self.log.exception("Failure sending notification on creation "
                                   "of ticket #%s: %s" % (t.id, e))
开发者ID:mohsadki,项目名称:dargest,代码行数:29,代码来源:theme.py


示例7: test_no_disown_from_changed_component

    def test_no_disown_from_changed_component(self):
        """
        Verify that a ticket is not disowned when the component is changed to
        a non-assigned component.
        """
        component1 = Component(self.env)
        component1.name = 'test1'
        component1.owner = 'joe'
        component1.insert()

        component2 = Component(self.env)
        component2.name = 'test2'
        component2.owner = ''
        component2.insert()

        ticket = Ticket(self.env)
        ticket['reporter'] = 'santa'
        ticket['summary'] = 'Foo'
        ticket['component'] = 'test1'
        ticket['status'] = 'new'
        tktid = ticket.insert()

        ticket = Ticket(self.env, tktid)
        ticket['component'] = 'test2'
        ticket.save_changes('jane', 'Testing')
        self.assertEqual('joe', ticket['owner'])
开发者ID:zjj,项目名称:trac_hack,代码行数:26,代码来源:model.py


示例8: get_changelog

 def get_changelog( self , ticketid):
   t = Ticket(self.macroenv.tracenv, ticketid)
   try: 
     return( t.get_changelog() )
   except:
     self.macroenv.tracenv.log.warning("get_changelog failed on ticket %s", ticketid)
     return [] # no changelogs
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:7,代码来源:pptickets.py


示例9: post_process_request

    def post_process_request(self, req, template, data, content_type):
        if template == 'timeline.html':
            filter_projects = self._filtered_projects(req)
            if not filter_projects: #no filter means likely more than 1 project, so we insert the project name
                filter_projects = [project[1] for project in self.__SmpModel.get_all_projects()]
            
            if filter_projects:               
                filtered_events = []
                tickettypes = ("newticket", "editedticket", "closedticket", "attachment", "reopenedticket")
                self._old_render_fn = []
                self._current_project = []
                self._read_idx = -1
                for event in data['events']:
                    if event['kind'] in tickettypes:
                        resource = event['kind'] == "attachment" and event['data'][0].parent or event['data'][0]
                        if resource.realm == "ticket":
                            ticket = Ticket( self.env, resource.id )   
                            project = ticket.get_value_or_default('project')
                            if project and project in filter_projects:
                                if len(filter_projects) > 1: #only if more than 1 filtered project
                                    #store the old render function and the project to be inserted
                                    self._old_render_fn.append(event['render'])
                                    self._current_project.append(project)
                                    #redirect to our new render function (which will insert the project name)
                                    event['render'] = self._render_ticket_event
                                #add to the list of displayed events
                                filtered_events.append(event)
                        
                    else:
                        filtered_events.append(event)
    
                data['events'] = filtered_events

        return template, data, content_type
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:34,代码来源:timeline.py


示例10: new_another_ticket

    def new_another_ticket(self, env, ticket, comment, author, trac):
	project_name = self.env.config.get('project','name')
	project_url = self.env.config.get('project','url')
	tkt_id = ticket.id
	tkt = Ticket(env)
	
	self.log.info("Ticket_id: %s" %(ticket.id))
                    
	tkt['status'] = 'new'
        tkt['reporter'] = project_name
        tkt['summary'] = '[' + project_name + '] #'+ str(tkt_id) +": "+ ticket['summary']
	
	description = ticket['description']
	if not comment == "":
	    comment = "\n * Comment: \n" + comment + "\n"
	ticket_url = "\n * Ticket: " + "[" + project_url + "/ticket/" + str(tkt_id) + " "  + project_name + "]"
	
        tkt['description'] = description + comment + ticket_url
	
	if ticket['taskstatus']:
	    tkt['taskstatus'] = trac['newstatus']
	
        self.log.info("tkt.insert")
	another_tkt_id = tkt.insert()
	if another_tkt_id:
	    self._insert_anotherticket(env, another_tkt_id, project_name, tkt_id)
	    self.notify(env, tkt, True)
	    return another_tkt_id
	else:
	    return False
开发者ID:spscream,项目名称:old_code,代码行数:30,代码来源:core.py


示例11: change_another_ticket

    def	change_another_ticket(self, env, tkt_id, comment, author, ticket, trac, action='another'):
	""" Change ticket in another_trac """
	self.log.info("Call change_another_ticket(%s)" %(tkt_id))
	another_proj_name = env.config.get('project','name')
	if not re.match(".* \["+ another_proj_name +"\]", author):
	    (db,cursor) = self._get_dbcursor(env)
	    utc = UTC()
	    when = datetime.now(utc)
	    project_name = self.env.config.get('project','name')
	
	    try:
		tkt = Ticket(env, tkt_id, db)
	    except util.TracError, detail:
		return False	    
	
	    if action == 'native':
		if 'closed' in ticket['status']:
		    cursor.execute("SELECT oldvalue,author FROM ticket_change WHERE ticket='"+tkt_id+"' AND field = 'owner' ORDER by time DESC LIMIT 1")
		    old_owner = cursor.fetchone()[0]
#		    tkt['owner'] = old_owner
		    tkt['owner'] = tkt['reporter']
		    if tkt['taskstatus']:
			tkt['taskstatus'] = trac['returnstatus']
		    
	
	    elif action == 'another':
		if 'closed' in tkt['status'] and 'closed' not in ticket['status']:
		    self.log.info("TICKET FIXED AND CLOSED! REOPEN IT!")
		    tkt['status'] = 'reopened'
		    tkt['resolution'] = ''
	
	    author = author + " [" + project_name + "]"
	    tkt.save_changes(author, comment, when)
	    self.notify(env, tkt, False, when)
	    return True
开发者ID:spscream,项目名称:old_code,代码行数:35,代码来源:core.py


示例12: test_props_format_wrap_bothsides_unicode

    def test_props_format_wrap_bothsides_unicode(self):
        self.env.config.set("notification", "mime_encoding", "none")
        self.env.config.set("notification", "ambiguous_char_width", "double")
        ticket = Ticket(self.env)
        ticket["summary"] = u"This is a summary"
        ticket["reporter"] = u"anonymous"
        ticket["status"] = u"new"
        ticket["owner"] = u"somebody"
        ticket["type"] = u"defect"
        ticket["priority"] = u"major"
        ticket["milestone"] = u"Trac 在经过修改的BSD协议下发布。" u"[1:]协议的完整文本可以[2:在线查" u"看]也可在发布版的 [3:COPYING] 文" u"件中找到。"
        ticket["component"] = (
            u"Trac は BSD ライセンスのもとで配"
            u"布されています。[1:]このライセ"
            u"ンスの全文は、 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python notification.TicketNotifyEmail类代码示例发布时间:2022-05-27
下一篇:
Python model.Priority类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap