Changeset 9644 for main


Ignore:
Timestamp:
16 Nov 2012, 08:30:20 (12 years ago)
Author:
Henrik Bettermann
Message:

Display start time of job in table.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/templates/reportscontainerpage.pt

    r9643 r9644  
    55        <th i18n:translate="">Report Number</th>
    66        <th i18n:translate="">Description</th>
     7        <th i18n:translate="">Creation Date</th>
    78        <th i18n:translate="">Status</th>
    89        <th>&nbsp;</th>
     
    1718          <span tal:replace="python: entry[1]">REPORT DESCRIPTION</span>
    1819        </td>
     20        <td nowrap>
     21          <span tal:replace="python: entry[5]">DATETIME</span>
     22        </td>
    1923        <td>
    2024          <span tal:replace="python: entry[2]">STATUS</span>
    2125        </td>
    22         <td>
     26        <td nowrap>
    2327          <form method="POST">
    2428            <input type="hidden" name="job_id"
  • main/waeup.kofa/trunk/src/waeup/kofa/reports.py

    r9642 r9644  
    2222from persistent.list import PersistentList
    2323from zope import schema
    24 from zope.component import getUtility, getUtilitiesFor, queryUtility
     24from zope.component import (
     25    getUtility, getUtilitiesFor, queryUtility, ComponentLookupError)
    2526from zope.component.hooks import setSite
    2627from zope.interface import implementer
     
    2829from waeup.kofa.async import AsyncJob
    2930from waeup.kofa.interfaces import (
    30     IJobManager, JOB_STATUS_MAP, IKofaPluggable, IKofaObject)
     31    IJobManager, JOB_STATUS_MAP, IKofaPluggable, IKofaObject, IKofaUtils)
    3132from waeup.kofa.interfaces import MessageFactory as _
    3233from waeup.kofa.utils.helpers import now
     
    104105        )
    105106
     107    starttime = schema.TextLine(
     108        title = u'Human readable start datetime')
     109
    106110    def __init__(site, generator_name):
    107111        """Create a report job via generator."""
     
    177181            downloaded. This is only true if the job finished and
    178182            didn't raised exceptions.
     183
     184        ``<starttime>``
     185            Datetime string indicating when the job was started.
    179186
    180187        If ``user_id`` is ``None``, all jobs are returned.
     
    291298    def __init__(self, site, generator_name, args=[], kw={}):
    292299        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
    293305        super(AsyncReportJob, self).__init__(
    294306            report_job, site, generator_name, args=args, kw=kw)
     
    461473            didn't raised exceptions.
    462474
     475        ``<starttime>``
     476            Datetime object indicating when the job was started.
     477
    463478        If ``user_id`` is ``None``, all jobs are returned.
    464479        """
     
    471486            discardable = job.finished
    472487            downloadable = job.finished and not job.failed
     488            starttime = job.starttime
    473489            if not hasattr(job, 'description'):
    474490                continue
    475491            result.append((job_id, job.description, status,
    476                            discardable, downloadable),)
     492                           discardable, downloadable, starttime),)
    477493        return result
    478494
  • main/waeup.kofa/trunk/src/waeup/kofa/tests/test_reports.py

    r9639 r9644  
    395395        self.assertEqual(
    396396            result,
    397             [('2', 'Report 1 ()', u'running', False, False),]
     397            [('2', 'Report 1 ()', u'running', False, False, None),]
    398398            )
    399399        return
Note: See TracChangeset for help on using the changeset viewer.