Changeset c1cebbc for server


Ignore:
Timestamp:
Jan 21, 2012, 2:17:07 PM (12 years ago)
Author:
Jessica B. Hamrick <jhamrick@…>
Branches:
no-cups
Children:
21b140d
Parents:
c500bc2
git-author:
Jessica B. Hamrick <jhamrick@…> (01/21/12 14:17:07)
git-committer:
Jessica B. Hamrick <jhamrick@…> (01/21/12 14:17:07)
Message:

Add restart job support to printer.py and job.py

Location:
server/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • server/lib/TODO

    r20f7360 rc1cebbc  
    2121     [ ] send uri
    2222     [ ] set job attributes
    23      [ ] restart job
    24      [ ] promote job
     23     [X] restart job
     24     [\] promote job
    2525
    2626- add support in job.py for:
  • server/lib/gutenbach/server/job.py

    rb8c3505 rc1cebbc  
    369369
    370370    def restart(self):
    371         # XXX: Todo
    372         pass
     371        """Non-blocking restart.  Job must be finished (see
     372        'GutenbachJob.is_done'), and will be ready to be played (see
     373        'GutenbachJob.is_ready') if this method is successful.
     374
     375        Raises
     376        ------
     377        InvalidJobStateException
     378            If the job is not done.
     379
     380        """
     381
     382        if not self.is_done:
     383            raise errors.InvalidJobStateException(self.state)
     384
     385        logger.debug("restarting job %d" % (self.id, self.document))
     386
     387        self._why_done = None
     388        self.spool(self.document)
  • server/lib/gutenbach/server/printer.py

    rc500bc2 rc1cebbc  
    402402        pass
    403403
    404     def restart_job(self):
    405         pass
    406 
    407     def promote_job(self, job_id):
     404    def restart_job(self, job_id, requesting_user_name=None):
     405        job = self.get_job(job_id)
     406        try:
     407            job.restart()
     408        except InvalidJobStateException:
     409            # XXX
     410            raise ipp.errors.ClientErrorNotPossible
     411
     412        with self.lock:
     413            self.finished_jobs.remove(job_id)
     414            self.pending_jobs.append(job_id)
     415
     416    def promote_job(self, job_id, requesting_user_name=None):
    408417        # According to RFC 3998, we need to put the job at the front
    409418        # of the queue (so that when the currently playing job
Note: See TracChangeset for help on using the changeset viewer.