Ignore:
Timestamp:
21 Dec 2012, 13:09:05 (12 years ago)
Author:
Henrik Bettermann
Message:

Extend IExportJob so that AsyncExportJobs? unveil their status like AsyncReportJobs? do. Use this property attribute to hide buttons.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/batching.py

    r9797 r9816  
    2828import tempfile
    2929import time
     30import zc.async.interfaces
    3031from cStringIO import StringIO
    3132from persistent.list import PersistentList
     
    571572            export_job, site, exporter_name, *args, **kwargs)
    572573
     574    @property
     575    def finished(self):
     576        """A job is marked `finished` if it is completed.
     577
     578        Please note: a finished report job does not neccessarily
     579        provide an IReport result. See meth:`failed`.
     580        """
     581        return self.status == zc.async.interfaces.COMPLETED
     582
     583    @property
     584    def failed(self):
     585        """A report job is marked failed iff it is finished and the
     586        result is None.
     587
     588        While a job is unfinished, the `failed` status is ``None``.
     589
     590        Failed jobs normally provide a `traceback` to examine reasons.
     591        """
     592        if not self.finished:
     593            return None
     594        if getattr(self, 'result', None) is None:
     595            return True
     596        return False
     597
    573598class ExportJobContainer(object):
    574599    """A mix-in that provides functionality for asynchronous export jobs.
Note: See TracChangeset for help on using the changeset viewer.