本文整理匯總了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()