Ignore:
Timestamp:
18 Nov 2012, 00:16:15 (12 years ago)
Author:
uli
Message:

More all-you-can-eat offers for views.

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

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/reports.py

    r9672 r9674  
    1919"""
    2020import grok
    21 from zope.component import getUtility
     21from zope.component import getUtility, queryUtility
    2222from zope.location.location import located
    23 from waeup.kofa.interfaces import IJobManager
     23from waeup.kofa.interfaces import IJobManager, IKofaUtils
    2424from waeup.kofa.interfaces import MessageFactory as _
    2525from waeup.kofa.browser.layout import KofaPage
    26 from waeup.kofa.reports import IReportsContainer
     26from waeup.kofa.reports import IReportsContainer, IReportGenerator
    2727from waeup.kofa.reports import get_generators
    2828
     
    4949            self.flash('Report discarded: %s' % job_id)
    5050        self.entries = self._generate_entries(user_id=None)
    51         #self.entries = self.context.get_report_jobs_description()
    5251        if job_id and DOWNLOAD:
    5352            self.redirect(self._report_url(job_id))
     
    6059            job_id, gen_name, user = entry
    6160            job = getUtility(IJobManager).get(job_id)
    62             descr = '%r, %r' % (job.args, job.kwargs)
    63             new_entry = (job_id, descr, job.status, job.finished, job.finished and not job.failed, not job.finished, job.begin_after, user)
     61            generator = queryUtility(IReportGenerator, name=gen_name)
     62            gen_title = getattr(generator, 'title', 'Unknown')
     63            args = ', '.join([str(x) for x in job.kwargs['kw'].values()])
     64            descr = '%s (%s)' % (gen_title, args)
     65            status = job.finished and 'ready' or 'running'
     66            status = job.failed and 'FAILED' or status
     67            starttime = getattr(job, 'begin_after', None)
     68            if starttime:
     69                starttime = starttime.astimezone(
     70                    getUtility(
     71                        IKofaUtils).tzinfo).strftime("%Y-%m-%d %H:%M:%S %Z")
     72            new_entry = (job_id, descr, status, job.finished, job.finished and not job.failed, not job.finished, starttime, user)
    6473            entries.append(new_entry)
    6574        return entries
  • main/waeup.kofa/trunk/src/waeup/kofa/reports.py

    r9673 r9674  
    171171
    172172    title = _("Unnamed Report")
     173
    173174    def generate(self, site, args=[], kw={}):
    174175        result = Report()
Note: See TracChangeset for help on using the changeset viewer.