本文整理汇总了Python中trac.ticket.model.Milestone.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Milestone.delete方法的具体用法?Python Milestone.delete怎么用?Python Milestone.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.ticket.model.Milestone
的用法示例。
在下文中一共展示了Milestone.delete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: copy_milestone
# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import delete [as 别名]
def copy_milestone(source_env, dest_env, name, dest_db=None):
# In case a string gets passed in
if not isinstance(source_env, Environment):
source_env = _open_environment(source_env)
if not isinstance(dest_env, Environment):
dest_env = _open_environment(dest_env)
# Log message
source_env.log.info('DatamoverPlugin: Moving milestone %s to the environment at %s', name, dest_env.path)
dest_env.log.info('DatamoverPlugin: Moving milestone %s from the environment at %s', name, source_env.path)
# Open databases
source_db = source_env.get_db_cnx()
source_cursor = source_db.cursor()
handle_commit = True
if not dest_db:
dest_db, handle_commit = dest_env.get_db_cnx(), False
dest_cursor = dest_db.cursor()
# Remove the milestone from the destination
try:
dest_milestone = Milestone(dest_env, name, db=dest_db)
dest_milestone.delete(retarget_to=name, db=dest_db)
except TracError:
pass
# Copy each entry in the milestone table
source_cursor.execute('SELECT * FROM milestone WHERE name=%s',(name,))
for row in source_cursor:
milestone_data = dict(zip([d[0] for d in source_cursor.description], row))
q = make_query(milestone_data, 'milestone')
dest_cursor.execute(*q)
if handle_commit:
dest_db.commit()
示例2: test_delete_milestone
# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import delete [as 别名]
def test_delete_milestone(self):
self.env.db_transaction("INSERT INTO milestone (name) VALUES ('Test')")
milestone = Milestone(self.env, 'Test')
milestone.delete()
self.assertEqual(False, milestone.exists)
self.assertEqual([],
self.env.db_query("SELECT * FROM milestone WHERE name='Test'"))
示例3: test_delete_milestone
# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import delete [as 别名]
def test_delete_milestone(self):
cursor = self.db.cursor()
cursor.execute("INSERT INTO milestone (name) VALUES ('Test')")
cursor.close()
milestone = Milestone(self.env, 'Test')
milestone.delete()
cursor = self.db.cursor()
cursor.execute("SELECT * FROM milestone WHERE name='Test'")
self.assertEqual(None, cursor.fetchone())
示例4: test_delete_milestone_retarget_tickets
# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import delete [as 别名]
def test_delete_milestone_retarget_tickets(self):
self.env.db_transaction("INSERT INTO milestone (name) VALUES ('Test')")
tkt1 = Ticket(self.env)
tkt1.populate({'summary': 'Foo', 'milestone': 'Test'})
tkt1.insert()
tkt2 = Ticket(self.env)
tkt2.populate({'summary': 'Bar', 'milestone': 'Test'})
tkt2.insert()
milestone = Milestone(self.env, 'Test')
milestone.delete(retarget_to='Other')
self.assertEqual(False, milestone.exists)
self.assertEqual('Other', Ticket(self.env, tkt1.id)['milestone'])
self.assertEqual('Other', Ticket(self.env, tkt2.id)['milestone'])
示例5: test_delete_milestone_retarget_tickets
# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import delete [as 别名]
def test_delete_milestone_retarget_tickets(self):
cursor = self.db.cursor()
cursor.execute("INSERT INTO milestone (name) VALUES ('Test')")
cursor.close()
tkt1 = Ticket(self.env)
tkt1.populate({'summary': 'Foo', 'milestone': 'Test'})
tkt1.insert()
tkt2 = Ticket(self.env)
tkt2.populate({'summary': 'Bar', 'milestone': 'Test'})
tkt2.insert()
milestone = Milestone(self.env, 'Test')
milestone.delete(retarget_to='Other')
self.assertEqual('Other', Ticket(self.env, tkt1.id)['milestone'])
self.assertEqual('Other', Ticket(self.env, tkt2.id)['milestone'])
示例6: test_delete_milestone_retarget_tickets
# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import delete [as 别名]
def test_delete_milestone_retarget_tickets(self):
cursor = self.db.cursor()
cursor.execute("INSERT INTO milestone (name) VALUES ('Test')")
cursor.close()
tkt1 = Ticket(self.env)
tkt1.populate({"summary": "Foo", "milestone": "Test"})
tkt1.insert()
tkt2 = Ticket(self.env)
tkt2.populate({"summary": "Bar", "milestone": "Test"})
tkt2.insert()
milestone = Milestone(self.env, "Test")
milestone.delete(retarget_to="Other")
self.assertEqual(False, milestone.exists)
self.assertEqual("Other", Ticket(self.env, tkt1.id)["milestone"])
self.assertEqual("Other", Ticket(self.env, tkt2.id)["milestone"])