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


Python Milestone.delete方法代码示例

本文整理汇总了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()
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:37,代码来源:util.py

示例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'"))
开发者ID:thimalk,项目名称:bloodhound,代码行数:10,代码来源:model.py

示例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())
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:13,代码来源:model.py

示例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'])
开发者ID:thimalk,项目名称:bloodhound,代码行数:18,代码来源:model.py

示例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'])
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:19,代码来源:model.py

示例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"])
开发者ID:wiraqutra,项目名称:photrackjp,代码行数:20,代码来源:model.py


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