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


Python Ticket.values[key]方法代码示例

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


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

示例1: invoke

# 需要导入模块: from trac.ticket import Ticket [as 别名]
# 或者: from trac.ticket.Ticket import values[key] [as 别名]
    def invoke(self, message, warnings):
        """make a new ticket on receiving email"""


        # local warnings
        _warnings = []

        # get the ticket reporter
        reporter = self._reporter(message)
        # get the description and attachments
        mailBody, attachments = get_body_and_attachments(message)
        mailBody += '\n'


        # get the ticket fields
        fields = self._fields(mailBody, _warnings, reporter=reporter)

        # inset items from email
        ticket = Ticket(self.env)
        for key, value in fields.items():
            ticket.values[key] = value



        # fill in default values
        for field in ticket.fields:
            name = field['name']
            if name not in fields:
                option = 'ticket_field.%s' % name
                if self.env.config.has_option('mail', option):
                    ticket.values[name] = self.env.config.get('mail', option)
                else:
                    try:
                        value = ticket.get_value_or_default(name) or ''
                    except AttributeError: # BBB
                        value = ''
                    if value is not None:
                        ticket.values[name] = value


        # create the ticket
        ticket.insert()

        # add attachments to the ticket
        add_attachments(self.env, ticket, attachments)

        # do whatever post-processing is necessary
        self.post_process(ticket)

        # add local warnings
        if _warnings:
            warning = """A ticket has been created but there is a problem:\n\n%s\n\nPlease edit your ticket by going here: %s""" % ('\n\n'.join([' - %s' % warning for warning in _warnings]), self.env.abs_href('ticket', ticket.id))
            warnings.append(warning)
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:55,代码来源:email2ticket.py


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