本文整理汇总了Python中trac.ticket.Milestone._old_name方法的典型用法代码示例。如果您正苦于以下问题:Python Milestone._old_name方法的具体用法?Python Milestone._old_name怎么用?Python Milestone._old_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.ticket.Milestone
的用法示例。
在下文中一共展示了Milestone._old_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_milestone
# 需要导入模块: from trac.ticket import Milestone [as 别名]
# 或者: from trac.ticket.Milestone import _old_name [as 别名]
def create_milestone(self, name, due=None, duration=20, db=None):
"""
Creates a milestone with the given name and due
date, the latter should be a datetime object
"""
db, handle_ta = get_db_for_write(self.env, db)
# Try to load the milestone first
try:
m = Milestone(self.env, name=name, db=db)
except ResourceNotFound:
# than we create it
m = Milestone(self.env, db=db)
m.name = name
if due is not None and isinstance(due, datetime):
dueo = due.toordinal() + duration
m.due = mktime(datetime.fromordinal(dueo).timetuple())
m.insert()
if handle_ta:
try:
db.commit()
# workaround for the fact that trac in 0.11.1 doesn't set exists correctly...
m._old_name = m.name
except Exception, e:
self.env.log.warning(exception_to_unicode(e))
db.rollback()