Changeset 9112


Ignore:
Timestamp:
26 Aug 2012, 13:40:01 (12 years ago)
Author:
uli
Message:

Add new helper function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/utils/batching.py

    r9095 r9112  
    621621        """Delete the export denoted by `entry`.
    622622
    623         Removes `entry` from the local `running_exports` list and also
     623        Removes given entry from the local `running_exports` list and also
    624624        removes the regarding job via the local job manager.
    625625
    626         `entry` is a tuple ``(<job id>, <exporter name>, <user id>)``
    627         as created by :meth:`start_export_job` or returned by
     626        `entry` must be a tuple ``(<job id>, <exporter name>, <user
     627        id>)`` as created by :meth:`start_export_job` or returned by
    628628        :meth:`get_running_export_jobs`.
    629629        """
     
    640640        self.running_exports = PersistentList(new_entries)
    641641        return
     642
     643    def entry_from_job_id(self, job_id):
     644        """Get entry tuple for `job_id`.
     645
     646        Returns ``None`` if no such entry can be found.
     647        """
     648        for entry in self.running_exports:
     649            if entry[0] == job_id:
     650                return entry
     651        return None
Note: See TracChangeset for help on using the changeset viewer.