Applied a patch from rjsparks@nostrum.com:

This fixes an issue with /doc/ad2 that is python library version related:

     ageseconds = (datetime.datetime.now()-doc.latest_event(type=3D'changed_document').time).total_seconds()

AttributeError: 'datetime.timedelta' object has no attribute 'total_seconds'

The production system is using 2.6, and that was a 2.7 feature.
 - Legacy-Id: 5665
This commit is contained in:
Henrik Levkowetz 2013-04-18 22:19:33 +00:00
parent 5d22df9e25
commit 7c35da472a

View file

@ -656,7 +656,8 @@ def ad_dashboard_sort_key(doc):
ageseconds = 0
changetime= doc.latest_event(type='changed_document')
if changetime:
ageseconds = (datetime.datetime.now()-doc.latest_event(type='changed_document').time).total_seconds()
ad = (datetime.datetime.now()-doc.latest_event(type='changed_document').time)
ageseconds = (ad.microseconds + (ad.seconds + ad.days * 24 * 3600) * 10**6) / 10**6
return "1%d%s%s%010d" % (state[0].order,seed,doc.type.slug,ageseconds)
return "3%s" % seed