Ignore:
Timestamp:
15 Aug 2015, 20:08:02 (9 years ago)
Author:
Henrik Bettermann
Message:

Do only allow one running export job.

File:
1 edited

Legend:

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

    r13198 r13199  
    246246        entries.append(new_entry)
    247247    return entries
     248
     249def running_jobs(view):
     250    """True if any job is running.
     251    """
     252    job_entries = view.context.get_running_export_jobs()
     253    job_manager = getUtility(IJobManager)
     254    entries = []
     255    for entry in job_entries:
     256        job = job_manager.get(entry[0])
     257        status = job.finished and 'ready' or 'running'
     258        status = job.failed and 'FAILED' or status
     259        if status == 'running':
     260            return True
     261    return False
    248262
    249263def getImporters(context):
     
    17521766                self.entries = doll_up(self, user=None)
    17531767                return
     1768            if running_jobs(self):
     1769                self.flash(_(
     1770                    "Sorry, another export job is running. "
     1771                    "Please try again later."), type='danger')
     1772                self.entries = doll_up(self, user=None)
     1773                return
    17541774            job_id = self.context.start_export_job(
    17551775                exporter, self.request.principal.id)
Note: See TracChangeset for help on using the changeset viewer.