Ignore:
Timestamp:
Dec 27, 2011, 11:33:55 PM (12 years ago)
Author:
Jessica B. Hamrick <jhamrick@…>
Branches:
no-cups
Children:
ce2abc5
Parents:
7c143c9
git-author:
Jessica B. Hamrick <jhamrick@…> (12/27/11 23:33:55)
git-committer:
Jessica B. Hamrick <jhamrick@…> (12/27/11 23:33:55)
Message:

Implement send-document operation and add threading so that the gutenbach server can play jobs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/lib/gutenbach/server/job.py

    ree8e6d0 re58af05  
    1 from exceptions import InvalidJobException, InvalidPrinterStateException
     1from . import InvalidJobException, InvalidPrinterStateException
    22import os
    33import gutenbach.ipp as ipp
     
    2424        This sets the status to 'initializing' and optionally sets the
    2525        document to print to the value of document.
     26
    2627        """
    2728
     
    3334        self.size     = size
    3435
    35         self.status   = ipp.JobStates.PENDING
     36        self.document = None
     37        self.document_name = None
     38
     39        self.status   = ipp.JobStates.HELD
    3640
    3741    def __getattr__(self, attr):
     
    9296
    9397    def play(self):
    94         if self.status != 'active':
    95             raise InvalidJobException(
    96                 "Cannot play an inactive job!")
    97        
    98         self.status = const.JobStates.PROCESSING
     98        logger.info("playing job %s" % str(self))
    9999        # TODO: add external call to music player
    100         print "Playing job %s" % str(self)
     100        self.status = ipp.JobStates.PROCESSING
    101101        self.printer.complete_job(self.jid)
    102102
    103103    def finish(self):
    104         self.status = const.JobStates.COMPLETE
     104        logger.info("finished job %s" % str(self))
     105        self.status = ipp.JobStates.COMPLETE
    105106
    106107    def __repr__(self):
Note: See TracChangeset for help on using the changeset viewer.