Changeset 9da7428


Ignore:
Timestamp:
Jan 21, 2012, 3:37:15 PM (12 years ago)
Author:
Jessica B. Hamrick <jhamrick@…>
Branches:
no-cups
Children:
c1dc25f
Parents:
72c3fcb
git-author:
Jessica B. Hamrick <jhamrick@…> (01/21/12 15:37:09)
git-committer:
Jessica B. Hamrick <jhamrick@…> (01/21/12 15:37:15)
Message:

Add support for set-job-attributes and set-printer-attributes in printer.py

Location:
server/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • server/lib/TODO

    rc1cebbc r9da7428  
    1818     [ ] pause printer
    1919     [ ] resume printer
    20      [ ] set printer attributes
     20     [\] set printer attributes
    2121     [ ] send uri
    22      [ ] set job attributes
     22     [\] set job attributes
    2323     [X] restart job
    2424     [\] promote job
    2525
    2626- add support in job.py for:
    27      [ ] restart job
     27     [X] restart job
    2828
    2929- finish test cases for printer.py
     
    5252   - local streaming
    5353   - generic streaming
     54   - zephyr control (e.g. youtube link)
    5455
    5556Tickets that should be fixed by this new version:
  • server/lib/gutenbach/server/printer.py

    rc1cebbc r9da7428  
    185185    def printer_uri_supported(self):
    186186        return ipp.PrinterUriSupported(self.uri)
     187    @printer_uri_supported.setter
     188    def printer_uri_supported(self, val):
     189        raise ipp.errors.AttributesNotSettable("printer-uri-supported")
    187190
    188191    @property
    189192    def uri_authentication_supported(self):
    190193        return ipp.UriAuthenticationSupported("none")
     194    @uri_authentication_supported.setter
     195    def uri_authentication_supported(self, val):
     196        raise ipp.errors.AttributesNotSettable("uri-authentication-supported")
    191197
    192198    @property
    193199    def uri_security_supported(self):
    194200        return ipp.UriSecuritySupported("none")
     201    @uri_security_supported.setter
     202    def uri_security_supported(self, val):
     203        raise ipp.errors.AttributesNotSettable("uri-security-supported")
    195204
    196205    @property
    197206    def printer_name(self):
    198207        return ipp.PrinterName(self.name)
     208    @printer_name.setter
     209    def printer_name(self, val):
     210        raise ipp.errors.AttributesNotSettable("printer-name")
    199211
    200212    @property
    201213    def printer_state(self):
    202214        return ipp.PrinterState(self.state)
     215    @printer_state.setter
     216    def printer_state(self, val):
     217        raise ipp.errors.AttributesNotSettable("printer-state")
    203218
    204219    @property
    205220    def printer_state_reasons(self):
    206221        return ipp.PrinterStateReasons("none")
     222    @printer_state_reasons.setter
     223    def printer_state_reasons(self, val):
     224        raise ipp.errors.AttributesNotSettable("printer-state-reasons")
    207225
    208226    @property
    209227    def ipp_versions_supported(self):
    210228        return ipp.IppVersionsSupported(*self.config['ipp-versions'])
     229    @ipp_versions_supported.setter
     230    def ipp_versions_supported(self, val):
     231        raise ipp.errors.AttributesNotSettable("ipp-versions-supported")
    211232
    212233    # XXX: We should query ourself for the supported operations
     
    214235    def operations_supported(self):
    215236        return ipp.OperationsSupported(ipp.OperationCodes.GET_JOBS)
     237    @operations_supported.setter
     238    def operations_supported(self, val):
     239        raise ipp.errors.AttributesNotSettable("operations-supported")
    216240
    217241    @property
    218242    def charset_configured(self):
    219         return ipp.CharsetConfigured("utf-8")
    220 
     243        return ipp.CharsetConfigured("utf-8") # XXX
     244    @charset_configured.setter
     245    def charset_configured(self, val):
     246        raise ipp.errors.AttributesNotSettable("charset-configured")
     247       
    221248    @property
    222249    def charset_supported(self):
    223         return ipp.CharsetSupported("utf-8")
     250        return ipp.CharsetSupported("utf-8") # XXX
     251    @charset_supported.setter
     252    def charset_supported(self, val):
     253        raise ipp.errors.AttributesNotSettable("charset-supported")
    224254
    225255    @property
    226256    def natural_language_configured(self):
    227257        return ipp.NaturalLanguageConfigured("en-us")
     258    @natural_language_configured.setter
     259    def natural_language_configured(self, val):
     260        raise ipp.errors.AttributesNotSettable("natural-language-configured")
    228261
    229262    @property
    230263    def generated_natural_language_supported(self):
    231264        return ipp.GeneratedNaturalLanguageSupported("en-us")
     265    @generated_natural_language_supported.setter
     266    def generated_natural_language_supported(self, val):
     267        raise ipp.errors.AttributesNotSettable("generated-natural-language-supported")
    232268
    233269    @property
    234270    def document_format_default(self):
    235271        return ipp.DocumentFormatDefault("application/octet-stream")
     272    @document_format_default.setter
     273    def document_format_default(self, val):
     274        raise ipp.errors.AttributesNotSettable("document-format-default")
    236275
    237276    @property
    238277    def document_format_supported(self):
    239278        return ipp.DocumentFormatSupported("application/octet-stream", "audio/mp3")
     279    @document_format_supported.setter
     280    def document_format_supported(self, val):
     281        raise ipp.errors.AttributesNotSettable("document-format-supported")
    240282
    241283    @property
    242284    def printer_is_accepting_jobs(self):
    243285        return ipp.PrinterIsAcceptingJobs(True)
     286    @printer_is_accepting_jobs.setter
     287    def printer_is_accepting_jobs(self, val):
     288        raise ipp.errors.AttributesNotSettable("printer-is-accepting-jobs")
    244289
    245290    @property
    246291    def queued_job_count(self):
    247292        return ipp.QueuedJobCount(len(self.active_jobs))
     293    @queued_job_count.setter
     294    def queued_job_count(self, val):
     295        raise ipp.errors.AttributesNotSettable("queued-job-count")
    248296
    249297    @property
    250298    def pdl_override_supported(self):
    251299        return ipp.PdlOverrideSupported("not-attempted")
     300    @pdl_override_supported.setter
     301    def pdl_override_supported(self, val):
     302        raise ipp.errors.AttributesNotSettable("pdl-override-supported")
    252303
    253304    @property
    254305    def printer_up_time(self):
    255306        return ipp.PrinterUpTime(int(time.time()) - self.time_created)
     307    @printer_up_time.setter
     308    def printer_up_time(self, val):
     309        raise ipp.errors.AttributesNotSettable("printer-up-time")
    256310
    257311    @property
    258312    def compression_supported(self):
    259313        return ipp.CompressionSupported("none")
     314    @compression_supported.setter
     315    def compression_supported(self, val):
     316        raise ipp.errors.AttributesNotSettable("compression-supported")
    260317
    261318    @property
    262319    def multiple_operation_time_out(self):
    263320        return ipp.MultipleOperationTimeOut(240)
     321    @multiple_operation_time_out.setter
     322    def multiple_operation_time_out(self, val):
     323        raise ipp.errors.AttributesNotSettable("multiple-operation-time-out")
    264324
    265325    @property
    266326    def multiple_document_jobs_supported(self):
    267327        return ipp.MultipleDocumentJobsSupported(False)
     328    @multiple_document_jobs_supported.setter
     329    def multiple_document_jobs_supported(self, val):
     330        raise ipp.errors.AttributesNotSettable("multiple-document-jobs-supported")
    268331
    269332    ######################################################################
     
    366429        return attributes
    367430
    368     def set_printer_attributes(self):
    369         pass
     431    def set_printer_attributes(self, job_id, attributes):
     432        for attr in attributes:
     433            try:
     434                setattr(self, attr, attributes[attr])
     435            except AttributeError:
     436                raise ipp.errors.ClientErrorAttributes
    370437
    371438    def cancel_job(self, job_id, requesting_user_name=None):
     
    399466        return attributes
    400467
    401     def set_job_attributes(self):
    402         pass
    403 
     468    def set_job_attributes(self, job_id, attributes):
     469        job = self.get_job(job_id)
     470        for attr in attributes:
     471            if attr in ("job-id", "job-k-octets", "job-state", "job-printer-uri"):
     472                raise ipp.errors.ClientErrorAttributesNotSettable(attr)
     473            elif attr == "job-name":
     474                job.name = attributes[attr]
     475            elif attr == "job-originating-user-name":
     476                job.creator = attributes[attr] # XXX: do we want this?
     477               
    404478    def restart_job(self, job_id, requesting_user_name=None):
    405479        job = self.get_job(job_id)
Note: See TracChangeset for help on using the changeset viewer.