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


Python Ticket.insert方法代码示例

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


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

示例1: create_ticket

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import insert [as 别名]
def create_ticket(env):
    t = Ticket(env)
    t["summary"] = "test"
    t["description"] = "ticket for test"
    t.insert()
    assert t.exists
    return t
开发者ID:karlamalta,项目名称:ProjetoFinal,代码行数:9,代码来源:utils.py

示例2: test_recipients

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import insert [as 别名]
 def test_recipients(self):
     """To/Cc recipients"""
     ticket = Ticket(self.env)
     ticket['reporter'] = '"Joe User" <[email protected]>'
     ticket['owner']    = '[email protected]'
     ticket['cc']       = '[email protected], [email protected], ' \
                          '[email protected]'
     ticket['summary'] = 'Foo'
     ticket.insert()
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=True)
     recipients = notifysuite.smtpd.get_recipients()
     # checks there is no duplicate in the recipient list
     rcpts = []
     for r in recipients:
         self.failIf(r in rcpts)
         rcpts.append(r)
     # checks that all cc recipients have been notified
     cc_list = self.env.config.get('notification', 'smtp_always_cc')
     cc_list = "%s, %s" % (cc_list, ticket['cc'])
     for r in cc_list.replace(',', ' ').split():
         self.failIf(r not in recipients)
     # checks that owner has been notified
     self.failIf(smtp_address(ticket['owner']) not in recipients)
     # checks that reporter has been notified
     self.failIf(smtp_address(ticket['reporter']) not in recipients)
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:28,代码来源:notification.py

示例3: _insert_ticket

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import insert [as 别名]
 def _insert_ticket(self, when=None, **kwargs):
     ticket = Ticket(self.env)
     for name, value in kwargs.iteritems():
         ticket[name] = value
     ticket['status'] = 'new'
     ticket.insert(when=when)
     return ticket
开发者ID:pkdevbox,项目名称:trac,代码行数:9,代码来源:report.py

示例4: test_props_format_wrap_bothsides_unicode

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import insert [as 别名]
    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"ンスの全文は、𠀋配布ファイル"
            u"に含まれている[3:CОPYING]ファイ"
            u"ルと同じものが[2:オンライン]で"
            u"参照できます。"
        )
        ticket["version"] = u"2.0"
        ticket["resolution"] = u"fixed"
        ticket["keywords"] = u""
        ticket.insert()
        formatted = """\
  Reporter:  anonymous               |      Owner:  somebody
      Type:  defect                  |     Status:  new
  Priority:  major                   |  Milestone:  Trac 在经过修改的BSD协
 Component:  Trac は BSD ライセンス  |  议下发布。[1:]协议的完整文本可以[2:
  のもとで配布されています。[1:]こ   |  在线查看]也可在发布版的 [3:COPYING]
  のライセンスの全文は、𠀋配布ファ   |  文件中找到。
  イルに含まれている[3:CОPYING]フ   |    Version:  2.0
  ァイルと同じものが[2:オンライン]   |   Keywords:
  で参照できます。                   |
Resolution:  fixed                   |"""
        self._validate_props_format(formatted, ticket)
开发者ID:moreati,项目名称:trac-gitsvn,代码行数:37,代码来源:notification.py

示例5: create

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import insert [as 别名]
    def create(self, req, summary, description, attributes = {}, notify=False):
        """ Create a new ticket, returning the ticket ID. 

        PS: Borrowed from XmlRpcPlugin.
        """
        t = Ticket(self.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()
        # Call ticket change listeners
        ts = TicketSystem(self.env)
        for listener in ts.change_listeners:
            listener.ticket_created(t)
        if notify:
            try:
                tn = TicketNotifyEmail(self.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:domaemon,项目名称:bloodhound-qa,代码行数:27,代码来源:theme.py

示例6: create

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import insert [as 别名]
    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,代码行数:31,代码来源:theme.py

示例7: test_props_format_wrap_leftside_unicode

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import insert [as 别名]
    def test_props_format_wrap_leftside_unicode(self):
        self.env.config.set("notification", "mime_encoding", "none")
        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"milestone1"
        ticket["component"] = (
            u"Trac は BSD ライセンスのもとで配"
            u"布されています。[1:]このライセ"
            u"ンスの全文は、配布ファイルに"
            u"含まれている [3:COPYING] ファイル"
            u"と同じものが[2:オンライン]で参"
            u"照できます。"
        )
        ticket["version"] = u"2.0"
        ticket["resolution"] = u"fixed"
        ticket["keywords"] = u""
        ticket.insert()
        formatted = """\
  Reporter:  anonymous                           |      Owner:  somebody
      Type:  defect                              |     Status:  new
  Priority:  major                               |  Milestone:  milestone1
 Component:  Trac は BSD ライセンスのもとで配布  |    Version:  2.0
  されています。[1:]このライセンスの全文は、配   |   Keywords:
  布ファイルに含まれている [3:COPYING] ファイル  |
  と同じものが[2:オンライン]で参照できます。     |
Resolution:  fixed                               |"""
        self._validate_props_format(formatted, ticket)
开发者ID:moreati,项目名称:trac-gitsvn,代码行数:34,代码来源:notification.py

示例8: test_email_map

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import insert [as 别名]
 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,代码行数:28,代码来源:notification.py

示例9: test_ignore_domains

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import insert [as 别名]
 def test_ignore_domains(self):
     """Non-SMTP domain exclusion"""
     self.env.config.set("notification", "ignore_domains", "example.com, example.org")
     self.env.known_users = [
         ("[email protected]", "No Email", ""),
         ("[email protected]", "With Email", "[email protected]"),
     ]
     ticket = Ticket(self.env)
     ticket["reporter"] = "[email protected]"
     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 not contain addresses with non-SMTP domains
     self.failIf("[email protected]" in tolist)
     self.failIf("[email protected]" in tolist)
     # 'To' list should have been resolved to the actual email address
     self.failIf("[email protected]" not in tolist)
     self.failIf(len(tolist) != 1)
开发者ID:moreati,项目名称:trac-gitsvn,代码行数:27,代码来源:notification.py

示例10: _test_short_login

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import insert [as 别名]
 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:moreati,项目名称:trac-gitsvn,代码行数:32,代码来源:notification.py

示例11: _test_default_domain

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import insert [as 别名]
 def _test_default_domain(enabled):
     self.env.config.set("notification", "always_notify_owner", "false")
     self.env.config.set("notification", "always_notify_reporter", "false")
     self.env.config.set("notification", "smtp_always_cc", "")
     ticket = Ticket(self.env)
     ticket["cc"] = "joenodom, [email protected]"
     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", "smtp_default_domain", "example.org")
     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 'Cc' field
     self.failIf("Cc" not in headers)
     cclist = [addr.strip() for addr in headers["Cc"].split(",")]
     self.failIf("[email protected]" not in cclist)
     self.failIf("[email protected]" not in cclist)
     if not enabled:
         self.failIf(len(cclist) != 2)
         self.failIf("joenodom" in cclist)
     else:
         self.failIf(len(cclist) != 3)
         self.failIf("[email protected]" not in cclist)
开发者ID:moreati,项目名称:trac-gitsvn,代码行数:30,代码来源:notification.py

示例12: test_date

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import insert [as 别名]
 def test_date(self):
     """Date format compliance (RFC822) 
        we do not support 'military' format"""
     date_str = (
         r"^((?P<day>\w{3}),\s*)*(?P<dm>\d{2})\s+"
         r"(?P<month>\w{3})\s+(?P<year>\d{4})\s+"
         r"(?P<hour>\d{2}):(?P<min>[0-5][0-9])"
         r"(:(?P<sec>[0-5][0-9]))*\s"
         r"((?P<tz>\w{2,3})|(?P<offset>[+\-]\d{4}))$"
     )
     date_re = re.compile(date_str)
     # python time module does not detect incorrect time values
     days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
     months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
     tz = ["UT", "GMT", "EST", "EDT", "CST", "CDT", "MST", "MDT", "PST", "PDT"]
     ticket = Ticket(self.env)
     ticket["reporter"] = '"Joe User" <[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)
     self.failIf("Date" not in headers)
     mo = date_re.match(headers["Date"])
     self.failIf(not mo)
     if mo.group("day"):
         self.failIf(mo.group("day") not in days)
     self.failIf(int(mo.group("dm")) not in range(1, 32))
     self.failIf(mo.group("month") not in months)
     self.failIf(int(mo.group("hour")) not in range(0, 24))
     if mo.group("tz"):
         self.failIf(mo.group("tz") not in tz)
开发者ID:moreati,项目名称:trac-gitsvn,代码行数:35,代码来源:notification.py

示例13: _test_default_domain

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import insert [as 别名]
 def _test_default_domain(enabled):
     self.env.config.set('notification', 'always_notify_owner',
                         'false')
     self.env.config.set('notification', 'always_notify_reporter',
                         'false')
     self.env.config.set('notification', 'smtp_always_cc', '')
     ticket = Ticket(self.env)
     ticket['cc'] = 'joenodom, [email protected]'
     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', 'smtp_default_domain',
                             'example.org')
     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 'Cc' field
     self.failIf('Cc' not in headers)
     cclist = [addr.strip() for addr in headers['Cc'].split(',')]
     self.failIf('[email protected]' not in cclist)
     self.failIf('[email protected]' not in cclist)
     if not enabled:
         self.failIf(len(cclist) != 2)
         self.failIf('joenodom' in cclist)
     else:
         self.failIf(len(cclist) != 3)
         self.failIf('[email protected]' not in cclist)
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:34,代码来源:notification.py

示例14: _test_updater

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import insert [as 别名]
 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]example.com' in tolist)
     else:
         self.failIf('[email protected]' not in tolist)
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:28,代码来源:notification.py

示例15: test_ignore_domains

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import insert [as 别名]
 def test_ignore_domains(self):
     """Non-SMTP domain exclusion"""
     self.env.config.set('notification', 'ignore_domains',
                         'example.com, example.org')
     self.env.known_users = \
         [('[email protected]', 'No Email', ''), 
          ('[email protected]', 'With Email', '[email protected]')]
     ticket = Ticket(self.env)
     ticket['reporter'] = '[email protected]'
     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 not contain addresses with non-SMTP domains
     self.failIf('[email protected]' in tolist)
     self.failIf('[email protected]' in tolist)
     # 'To' list should have been resolved to the actual email address
     self.failIf('[email protected]' not in tolist)
     self.failIf(len(tolist) != 1)
开发者ID:gdgkyoto,项目名称:kyoto-gtug,代码行数:27,代码来源:notification.py


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