Changeset 94a4825


Ignore:
Timestamp:
Dec 23, 2011, 12:30:15 PM (12 years ago)
Author:
Jessica B. Hamrick <jhamrick@…>
Branches:
no-cups
Children:
f6e2532
Parents:
c16ebf6
git-author:
Jessica B. Hamrick <jhamrick@…> (12/23/11 12:30:15)
git-committer:
Jessica B. Hamrick <jhamrick@…> (12/23/11 12:30:15)
Message:

Add handler decorators for other handlers and throw an exception if they're not implemented; add documentation for create-job handler

Location:
server/lib/gutenbach
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • server/lib/gutenbach/ipp/constants.py

    r71bfce0 r94a4825  
    5959    #HOLD_JOB              = 0x000c
    6060    #RELEASE_JOB           = 0x000d
    61     #RESTART_JOB           = 0x000e
     61    RESTART_JOB            = 0x000e
    6262    PAUSE_PRINTER          = 0x0010
    6363    RESUME_PRINTER         = 0x0011
  • server/lib/gutenbach/server/requests.py

    re70c020 r94a4825  
    7373    ##### Printer Commands
    7474
     75    @handler_for(consts.Operations.PRINT_JOB)
    7576    def print_job(self, request):
    7677        """RFC 2911: 3.2.1 Print-Job Operation
     
    8485        """
    8586       
    86         pass
    87 
     87        raise NotImplementedError
     88
     89    @handler_for(consts.Operations.VALIDATE_JOB)
    8890    def validate_job(self, request):
    89         pass
     91
     92        raise NotImplementedError
    9093
    9194    @handler_for(consts.Operations.GET_JOBS)
     
    123126        return response
    124127
     128    @handler_for(consts.Operations.PRINT_URI)
    125129    def print_uri(self, request):
    126         pass
    127 
     130        raise NotImplementedError
     131
     132    @handler_for(consts.Operations.CREATE_JOB)
    128133    def create_job(self, request):
    129         pass
    130 
     134        """RFC 2911: 3.2.4 Create-Job Operation
     135
     136        This OPTIONAL operation is similar to the Print-Job operation
     137        (section 3.2.1) except that in the Create-Job request, a
     138        client does not supply document data or any reference to
     139        document data. Also, the client does not supply any of the
     140        'document-name', 'document- format', 'compression', or
     141        'document-natural-language' operation attributes. This
     142        operation is followed by one or more Send-Document or Send-URI
     143        operations. In each of those operation requests, the client
     144        OPTIONALLY supplies the 'document-name', 'document-format',
     145        and 'document-natural-language' attributes for each document
     146        in the multi-document Job object.
     147
     148        If a Printer object supports the Create-Job operation, it MUST
     149        also support the Send-Document operation and also MAY support
     150        the Send-URI operation.
     151       
     152        If the Printer object supports this operation, it MUST support
     153        the 'multiple-operation-time-out' Printer attribute (see
     154        section 4.4.31).  If the Printer object supports this
     155        operation, then it MUST support the
     156        'multiple-document-jobs-supported' Printer Description
     157        attribute (see section 4.4.16) and indicate whether or not it
     158        supports multiple-document jobs.
     159       
     160        If the Printer object supports this operation and supports
     161        multiple documents in a job, then it MUST support the
     162        'multiple-document- handling' Job Template job attribute with
     163        at least one value (see section 4.2.4) and the associated
     164        'multiple-document-handling- default' and
     165        'multiple-document-handling-supported' Job Template Printer
     166        attributes (see section 4.2).
     167       
     168        After the Create-Job operation has completed, the value of the
     169        'job- state' attribute is similar to the 'job-state' after a
     170        Print-Job, even though no document-data has arrived. A Printer
     171        MAY set the 'job-data-insufficient' value of the job's
     172        'job-state-reason' attribute to indicate that processing
     173        cannot begin until sufficient data has arrived and set the
     174        'job-state' to either 'pending' or 'pending-held'. A
     175        non-spooling printer that doesn't implement the 'pending' job
     176        state may even set the 'job-state' to 'processing', even
     177        though there is not yet any data to process. See sections
     178        4.3.7 and 4.3.8.
     179       
     180        """
     181
     182        raise NotImplementedError
     183   
     184    @handler_for(consts.Operations.PAUSE_PRINTER)
    131185    def pause_printer(self, request):
    132         pass
    133 
     186        raise NotImplementedError
     187
     188    @handler_for(consts.Operations.RESUME_PRINTER)
    134189    def resume_printer(self, request):
    135         pass
     190        raise NotImplementedError
    136191
    137192    @handler_for(consts.Operations.GET_PRINTER_ATTRIBUTES)
     
    194249        return response
    195250
     251    @handler_for(consts.Operations.SET_PRINTER_ATTRIBUTES)
    196252    def set_printer_attributes(self, request):
    197         pass
     253        raise NotImplementedError
    198254
    199255    ##### Job Commands
    200256
     257    @handler_for(consts.Operations.CANCEL_JOB)
    201258    def cancel_job(self, request):
    202         pass
    203 
     259        raise NotImplementedError
     260
     261    @handler_for(consts.Operations.SEND_DOCUMENT)
    204262    def send_document(self, request):
    205         pass
    206 
     263        raise NotImplementedError
     264
     265    @handler_for(consts.Operations.SEND_URI)
    207266    def send_uri(self, request):
    208         pass
    209 
     267        raise NotImplementedError
     268
     269    @handler_for(consts.Operations.GET_JOB_ATTRIBUTES)
    210270    def get_job_attributes(self, request):
    211271       
     
    234294        return response
    235295
     296    @handler_for(consts.Operations.SET_JOB_ATTRIBUTES)
    236297    def set_job_attributes(self, request):
    237         pass
    238 
     298        raise NotImplementedError
     299
     300    @handler_for(consts.Operations.RESTART_JOB)
    239301    def restart_job(self, request):
    240         pass
    241 
     302        raise NotImplementedError
     303
     304    @handler_for(consts.Operations.PROMOTE_JOB)
    242305    def promote_job(self, request):
    243         pass
     306        raise NotImplementedError
    244307
    245308    ##### CUPS Specific Commands
    246309
     310    @handler_for(consts.Operations.CUPS_GET_DOCUMENT)
    247311    def cups_get_document(self, request):
    248         pass
     312        raise NotImplementedError
    249313
    250314    @handler_for(consts.Operations.CUPS_GET_DEFAULT)
Note: See TracChangeset for help on using the changeset viewer.