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


Python Ticket.delete_change方法代码示例

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


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

示例1: test_delete_mid_comment_inconsistent

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import delete_change [as 别名]
    def test_delete_mid_comment_inconsistent(self):
        # Make oldvalue on keywords for change 4 inconsistent. This should
        # result in no change in oldvalue when deleting change 3. The
        # oldvalue of foo should change normally.
        cursor = self.db.cursor()
        cursor.execute("UPDATE ticket_change SET oldvalue='1, 2' " "WHERE field='keywords' AND oldvalue='a, b'")
        self.db.commit()

        ticket = Ticket(self.env, self.id)
        self.assertChange(
            ticket,
            4,
            self.t4,
            "joe",
            comment=dict(author="joe", old="4", new="Comment 4"),
            keywords=dict(author="joe", old="1, 2", new="a"),
            foo=dict(author="joe", old="change3", new="change4"),
        )
        ticket.delete_change(3)
        self.assertEqual(None, ticket.get_change(3))
        self.assertEqual("a", ticket["keywords"])
        self.assertChange(
            ticket,
            4,
            self.t4,
            "joe",
            comment=dict(author="joe", old="4", new="Comment 4"),
            keywords=dict(author="joe", old="1, 2", new="a"),
            foo=dict(author="joe", old="change2", new="change4"),
        )
开发者ID:wiraqutra,项目名称:photrackjp,代码行数:32,代码来源:model.py

示例2: test_delete_all_comments

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import delete_change [as 别名]
 def test_delete_all_comments(self):
     # See ticket:10338
     ticket = Ticket(self.env, self.id)
     ticket.delete_change(4)
     ticket.delete_change(3)
     ticket.delete_change(2)
     ticket.delete_change(1)
     self.assertEquals(ticket['time'], ticket['changetime'])
开发者ID:moreati,项目名称:trac-gitsvn,代码行数:10,代码来源:model.py

示例3: test_delete_last_comment

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import delete_change [as 别名]
 def test_delete_last_comment(self):
     ticket = Ticket(self.env, self.id)
     self.assertEqual('a', ticket['keywords'])
     self.assertEqual('change4', ticket['foo'])
     ticket.delete_change(4)
     self.assertEqual('a, b', ticket['keywords'])
     self.assertEqual('change3', ticket['foo'])
     self.assertEqual(None, ticket.get_change(4))
     self.assertNotEqual(None, ticket.get_change(3))
     self.assertEqual(self.t3, ticket.time_changed)
开发者ID:zjj,项目名称:trac_hack,代码行数:12,代码来源:model.py

示例4: test_delete_last_comment_by_date

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import delete_change [as 别名]
 def test_delete_last_comment_by_date(self):
     ticket = Ticket(self.env, self.id)
     self.assertEqual('a', ticket['keywords'])
     self.assertEqual('change4', ticket['foo'])
     t = datetime.now(utc)
     ticket.delete_change(cdate=self.t4, when=t)
     self.assertEqual('a, b', ticket['keywords'])
     self.assertEqual('change3', ticket['foo'])
     self.assertEqual(None, ticket.get_change(cdate=self.t4))
     self.assertNotEqual(None, ticket.get_change(cdate=self.t3))
     self.assertEqual(t, ticket.time_changed)
开发者ID:thimalk,项目名称:bloodhound,代码行数:13,代码来源:model.py

示例5: test_delete_mid_comment

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import delete_change [as 别名]
 def test_delete_mid_comment(self):
     ticket = Ticket(self.env, self.id)
     self.assertChange(ticket, 4, self.t4, 'joe',
         comment=dict(author='joe', old='4', new='Comment 4'),
         keywords=dict(author='joe', old='a, b', new='a'),
         foo=dict(author='joe', old='change3', new='change4'))
     ticket.delete_change(3)
     self.assertEqual(None, ticket.get_change(3))
     self.assertEqual('a', ticket['keywords'])
     self.assertChange(ticket, 4, self.t4, 'joe',
         comment=dict(author='joe', old='4', new='Comment 4'),
         keywords=dict(author='joe', old='a, b, c', new='a'),
         foo=dict(author='joe', old='change2', new='change4'))
     self.assertEqual(self.t4, ticket.time_changed)
开发者ID:zjj,项目名称:trac_hack,代码行数:16,代码来源:model.py

示例6: process_request

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import delete_change [as 别名]
    def process_request(self, req):
        id = int(req.args.get('id'))
        req.perm('ticket', id).require('TICKET_ADMIN')
        ticket = Ticket(self.env, id)
        action = req.args['action']
        cnum = req.args.get('cnum')
        if req.method == 'POST':
            if 'cancel' in req.args:
                href = req.href.ticket(id)
                if action == 'delete-comment':
                    href += '#comment:%s' % cnum
                req.redirect(href)

            if action == 'delete':
                ticket.delete()
                add_notice(req, _('The ticket #%(id)s has been deleted.',
                                  id=ticket.id))
                req.redirect(req.href())

            elif action == 'delete-comment':
                cdate = from_utimestamp(long(req.args.get('cdate')))
                ticket.delete_change(cdate=cdate)
                add_notice(req, _('The ticket comment %(num)s on ticket '
                                  '#%(id)s has been deleted.',
                                  num=cnum, id=ticket.id))
                req.redirect(req.href.ticket(id))

        tm = TicketModule(self.env)
        data = tm._prepare_data(req, ticket)
        tm._insert_ticket_data(req, ticket, data,
                               get_reporter_id(req, 'author'), {})
        data.update(action=action, cdate=None)

        if action == 'delete-comment':
            data['cdate'] = req.args.get('cdate')
            cdate = from_utimestamp(long(data['cdate']))
            for change in data['changes']:
                if change.get('date') == cdate:
                    data['change'] = change
                    data['cnum'] = change.get('cnum')
                    break
            else:
                raise TracError(_('Comment %(num)s not found', num=cnum))
        elif action == 'delete':
            attachments = Attachment.select(self.env, ticket.realm, ticket.id)
            data.update(attachments=list(attachments))

        add_stylesheet(req, 'common/css/ticket.css')
        return 'ticket_delete.html', data, None
开发者ID:pkdevbox,项目名称:trac,代码行数:51,代码来源:deleter.py

示例7: test_delete_mid_comment_inconsistent

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import delete_change [as 别名]
 def test_delete_mid_comment_inconsistent(self):
     # Make oldvalue on keywords for change 4 inconsistent. This should
     # result in no change in oldvalue when deleting change 3. The
     # oldvalue of foo should change normally.
     self.env.db_transaction("""
         UPDATE ticket_change SET oldvalue='1, 2'
         WHERE field='keywords' AND oldvalue='a, b'
         """)
     ticket = Ticket(self.env, self.id)
     self.assertChange(ticket, 4, self.t4, 'joe',
         comment=dict(author='joe', old='4', new='Comment 4'),
         keywords=dict(author='joe', old='1, 2', new='a'),
         foo=dict(author='joe', old='change3', new='change4'))
     ticket.delete_change(3)
     self.assertEqual(None, ticket.get_change(3))
     self.assertEqual('a', ticket['keywords'])
     self.assertChange(ticket, 4, self.t4, 'joe',
         comment=dict(author='joe', old='4', new='Comment 4'),
         keywords=dict(author='joe', old='1, 2', new='a'),
         foo=dict(author='joe', old='change2', new='change4'))
开发者ID:thimalk,项目名称:bloodhound,代码行数:22,代码来源:model.py

示例8: test_delete_all_comments

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import delete_change [as 别名]
 def test_delete_all_comments(self):
     ticket = Ticket(self.env, self.id)
     ticket.delete_change(4)
     ticket.delete_change(3)
     ticket.delete_change(2)
     t = datetime.now(utc)
     ticket.delete_change(1, when=t)
     self.assertEqual(t, ticket.time_changed)
开发者ID:thimalk,项目名称:bloodhound,代码行数:10,代码来源:model.py

示例9: test_delete_last_comment_when_custom_field_gone

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import delete_change [as 别名]
 def test_delete_last_comment_when_custom_field_gone(self):
     """Regression test for http://trac.edgewall.org/ticket/10858"""
     ticket = Ticket(self.env, self.id)
     self.assertEqual('a', ticket['keywords'])
     self.assertEqual('change4', ticket['foo'])
     # we simulate the removal of the definition of the 'foo' custom field
     self.env.config.remove('ticket-custom', 'foo')
     del TicketSystem(self.env).fields
     del TicketSystem(self.env).custom_fields
     ticket = Ticket(self.env, self.id)
     #
     t = datetime.now(utc)
     ticket.delete_change(cnum=4, when=t)
     self.assertEqual('a, b', ticket['keywords'])
     # 'foo' is no longer defined for the ticket
     self.assertEqual(None, ticket['foo'])
     # however, 'foo=change3' is still in the database
     self.assertEqual([('change3',)], self.env.db_query("""
         SELECT value FROM ticket_custom WHERE ticket=%s AND name='foo'
         """, (self.id,)))
     self.assertEqual(None, ticket.get_change(cnum=4))
     self.assertNotEqual(None, ticket.get_change(cnum=3))
     self.assertEqual(t, ticket.time_changed)
开发者ID:thimalk,项目名称:bloodhound,代码行数:25,代码来源:model.py

示例10: test_delete_mid_comment

# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import delete_change [as 别名]
 def test_delete_mid_comment(self):
     ticket = Ticket(self.env, self.id)
     self.assertChange(
         ticket,
         4,
         self.t4,
         "joe",
         comment=dict(author="joe", old="4", new="Comment 4"),
         keywords=dict(author="joe", old="a, b", new="a"),
         foo=dict(author="joe", old="change3", new="change4"),
     )
     ticket.delete_change(3)
     self.assertEqual(None, ticket.get_change(3))
     self.assertEqual("a", ticket["keywords"])
     self.assertChange(
         ticket,
         4,
         self.t4,
         "joe",
         comment=dict(author="joe", old="4", new="Comment 4"),
         keywords=dict(author="joe", old="a, b, c", new="a"),
         foo=dict(author="joe", old="change2", new="change4"),
     )
     self.assertEqual(self.t4, ticket.time_changed)
开发者ID:wiraqutra,项目名称:photrackjp,代码行数:26,代码来源:model.py


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