Changeset aded2d1 for server/lib/gutenbach/server/printer.py
- Timestamp:
- Dec 23, 2011, 8:20:29 PM (12 years ago)
- Branches:
- no-cups
- Children:
- b828a96
- Parents:
- f6e2532
- git-author:
- Jessica B. Hamrick <jhamrick@…> (12/23/11 20:20:29)
- git-committer:
- Jessica B. Hamrick <jhamrick@…> (12/23/11 20:20:29)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/lib/gutenbach/server/printer.py
rf6e2532 raded2d1 4 4 import gutenbach.ipp as ipp 5 5 import gutenbach.ipp.constants as const 6 import gutenbach.ipp.object_attributes.printer_description_attributes as pda 6 7 import logging 7 8 import time … … 88 89 @property 89 90 def printer_uri_supported(self): 90 return self.uri91 return pda.PrinterUriSupported(self.uri) 91 92 92 93 @property 93 94 def uri_authentication_supported(self): 94 return "none"95 return pda.UriAuthenticationSupported("none") 95 96 96 97 @property 97 98 def uri_security_supported(self): 98 return "none"99 return pda.UriSecuritySupported("none") 99 100 100 101 @property 101 102 def printer_name(self): 102 return self.name103 return pda.PrinterName(self.name) 103 104 104 105 @property 105 106 def printer_state(self): 106 return 3 # idle107 return pda.PrinterState(ipp.constants.PrinterStates.IDLE) 107 108 108 109 @property 109 110 def printer_state_reasons(self): 110 return "none"111 return pda.PrinterStateReasons("none") 111 112 112 113 @property 113 114 def ipp_versions_supported(self): 114 return ("1.0", "1.1")115 return pda.IppVersionsSupported("1.0", "1.1") 115 116 116 117 # XXX: We should query ourself for the supported operations 117 118 @property 118 119 def operations_supported(self): 119 return ipp.Operations.GET_JOBS # get-jobs120 return pda.OperationsSupported(ipp.Operations.GET_JOBS) 120 121 121 122 @property 122 123 def charset_configured(self): 123 return "utf-8"124 return pda.CharsetConfigured("utf-8") 124 125 125 126 @property 126 127 def charset_supported(self): 127 return "utf-8"128 return pda.CharsetSupported("utf-8") 128 129 129 130 @property 130 131 def natural_language_configured(self): 131 return "en-us"132 return pda.NaturalLanguageConfigured("en-us") 132 133 133 134 @property 134 135 def generated_natural_language_supported(self): 135 return "en-us"136 return pda.GeneratedNaturalLanguageSupported("en-us") 136 137 137 138 @property 138 139 def document_format_default(self): 139 return "application/octet-stream"140 return pda.DocumentFormatDefault("application/octet-stream") 140 141 141 142 @property 142 143 def document_format_supported(self): 143 return ("application/octet-stream", "audio/mp3")144 return pda.DocumentFormatSupported("application/octet-stream", "audio/mp3") 144 145 145 146 @property 146 147 def printer_is_accepting_jobs(self): 147 return True148 return pda.PrinterIsAcceptingJobs(True) 148 149 149 150 @property 150 151 def queued_job_count(self): 151 return len(self.active_jobs)152 return pda.QueuedJobCount(len(self.active_jobs)) 152 153 153 154 @property 154 155 def pdl_override_supported(self): 155 return "not-attempted"156 return pda.PdlOverrideSupported("not-attempted") 156 157 157 158 @property 158 159 def printer_up_time(self): 159 return int(time.time()) - self.time_created160 return pda.PrinterUpTime(int(time.time()) - self.time_created) 160 161 161 162 @property 162 163 def compression_supported(self): 163 return "none"164 return pda.CompressionSupported("none") 164 165 165 166 @property 166 167 def multiple_operation_time_out(self): 167 return 240168 return pda.MultipleOperationTimeOut(240) 168 169 169 170 @property 170 171 def multiple_document_jobs_supported(self): 171 return False172 return pda.MultipleDocumentJobsSupported(False) 172 173 173 174 def get_printer_attributes(self, request): 174 attributes = [(attr, getattr(self, attr)) for attr in self.attributes] 175 attributes = map(lambda x: x if isinstance(x[1], (tuple, list)) else (x[0], [x[1]]), 176 attributes) 175 attributes = [getattr(self, attr) for attr in self.attributes] 177 176 return attributes 178 177
Note: See TracChangeset
for help on using the changeset viewer.