本文整理汇总了Python中trac.ticket.model.Ticket.date方法的典型用法代码示例。如果您正苦于以下问题:Python Ticket.date方法的具体用法?Python Ticket.date怎么用?Python Ticket.date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.ticket.model.Ticket
的用法示例。
在下文中一共展示了Ticket.date方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createDiff
# 需要导入模块: from trac.ticket.model import Ticket [as 别名]
# 或者: from trac.ticket.model.Ticket import date [as 别名]
def createDiff( ticket_id ):
'''
HACK: need an indicator when the ticket was created lately
'''
diff = -1
if ticket_id != None:
created = Ticket(self.env, int(ticket_id)).time_created
now = datetime.now(created.tzinfo) # needs tzinfo!
created = datetime.combine( created.date(), created.time() )
now = datetime.combine( now.date(), now.time() )
diff = now - created
diff = diff.seconds + diff.days * 24 * 3600 # calculated here, to be compatible to python <2.7
return diff