Changeset 9644 for main/waeup.kofa/trunk/src/waeup/kofa/reports.py
- Timestamp:
- 16 Nov 2012, 08:30:20 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/reports.py
r9642 r9644 22 22 from persistent.list import PersistentList 23 23 from zope import schema 24 from zope.component import getUtility, getUtilitiesFor, queryUtility 24 from zope.component import ( 25 getUtility, getUtilitiesFor, queryUtility, ComponentLookupError) 25 26 from zope.component.hooks import setSite 26 27 from zope.interface import implementer … … 28 29 from waeup.kofa.async import AsyncJob 29 30 from waeup.kofa.interfaces import ( 30 IJobManager, JOB_STATUS_MAP, IKofaPluggable, IKofaObject )31 IJobManager, JOB_STATUS_MAP, IKofaPluggable, IKofaObject, IKofaUtils) 31 32 from waeup.kofa.interfaces import MessageFactory as _ 32 33 from waeup.kofa.utils.helpers import now … … 104 105 ) 105 106 107 starttime = schema.TextLine( 108 title = u'Human readable start datetime') 109 106 110 def __init__(site, generator_name): 107 111 """Create a report job via generator.""" … … 177 181 downloaded. This is only true if the job finished and 178 182 didn't raised exceptions. 183 184 ``<starttime>`` 185 Datetime string indicating when the job was started. 179 186 180 187 If ``user_id`` is ``None``, all jobs are returned. … … 291 298 def __init__(self, site, generator_name, args=[], kw={}): 292 299 self._generator_name = generator_name 300 try: 301 tz = getUtility(IKofaUtils).tzinfo 302 self.starttime = now(tz).strftime("%Y-%m-%d %H:%M:%S %Z") 303 except ComponentLookupError: 304 self.starttime = None 293 305 super(AsyncReportJob, self).__init__( 294 306 report_job, site, generator_name, args=args, kw=kw) … … 461 473 didn't raised exceptions. 462 474 475 ``<starttime>`` 476 Datetime object indicating when the job was started. 477 463 478 If ``user_id`` is ``None``, all jobs are returned. 464 479 """ … … 471 486 discardable = job.finished 472 487 downloadable = job.finished and not job.failed 488 starttime = job.starttime 473 489 if not hasattr(job, 'description'): 474 490 continue 475 491 result.append((job_id, job.description, status, 476 discardable, downloadable ),)492 discardable, downloadable, starttime),) 477 493 return result 478 494
Note: See TracChangeset for help on using the changeset viewer.