Changeset 9225351 for server/lib/gutenbach/server/printer.py
- Timestamp:
- Jan 21, 2012, 4:36:37 PM (12 years ago)
- Branches:
- no-cups
- Children:
- 15fb0f8, 374c558
- Parents:
- fa3e2c6 (diff), 56fd535 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - git-author:
- Steven Allen <steven@…> (01/21/12 16:36:37)
- git-committer:
- Steven Allen <steven@…> (01/21/12 16:36:37)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/lib/gutenbach/server/printer.py
rfa3e2c6 r9225351 184 184 def printer_uri_supported(self): 185 185 return ipp.PrinterUriSupported(self.uri) 186 @printer_uri_supported.setter 187 def printer_uri_supported(self, val): 188 raise ipp.errors.AttributesNotSettable("printer-uri-supported") 186 189 187 190 @property 188 191 def uri_authentication_supported(self): 189 192 return ipp.UriAuthenticationSupported("none") 193 @uri_authentication_supported.setter 194 def uri_authentication_supported(self, val): 195 raise ipp.errors.AttributesNotSettable("uri-authentication-supported") 190 196 191 197 @property 192 198 def uri_security_supported(self): 193 199 return ipp.UriSecuritySupported("none") 200 @uri_security_supported.setter 201 def uri_security_supported(self, val): 202 raise ipp.errors.AttributesNotSettable("uri-security-supported") 194 203 195 204 @property 196 205 def printer_name(self): 197 206 return ipp.PrinterName(self.name) 207 @printer_name.setter 208 def printer_name(self, val): 209 raise ipp.errors.AttributesNotSettable("printer-name") 198 210 199 211 @property 200 212 def printer_state(self): 201 213 return ipp.PrinterState(self.state) 214 @printer_state.setter 215 def printer_state(self, val): 216 raise ipp.errors.AttributesNotSettable("printer-state") 202 217 203 218 @property 204 219 def printer_state_reasons(self): 205 220 return ipp.PrinterStateReasons("none") 221 @printer_state_reasons.setter 222 def printer_state_reasons(self, val): 223 raise ipp.errors.AttributesNotSettable("printer-state-reasons") 206 224 207 225 @property 208 226 def ipp_versions_supported(self): 209 227 return ipp.IppVersionsSupported(*self.config['ipp-versions']) 228 @ipp_versions_supported.setter 229 def ipp_versions_supported(self, val): 230 raise ipp.errors.AttributesNotSettable("ipp-versions-supported") 210 231 211 232 # XXX: We should query ourself for the supported operations … … 213 234 def operations_supported(self): 214 235 return ipp.OperationsSupported(ipp.OperationCodes.GET_JOBS) 236 @operations_supported.setter 237 def operations_supported(self, val): 238 raise ipp.errors.AttributesNotSettable("operations-supported") 215 239 216 240 @property 217 241 def charset_configured(self): 218 return ipp.CharsetConfigured("utf-8") 219 242 return ipp.CharsetConfigured("utf-8") # XXX 243 @charset_configured.setter 244 def charset_configured(self, val): 245 raise ipp.errors.AttributesNotSettable("charset-configured") 246 220 247 @property 221 248 def charset_supported(self): 222 return ipp.CharsetSupported("utf-8") 249 return ipp.CharsetSupported("utf-8") # XXX 250 @charset_supported.setter 251 def charset_supported(self, val): 252 raise ipp.errors.AttributesNotSettable("charset-supported") 223 253 224 254 @property 225 255 def natural_language_configured(self): 226 256 return ipp.NaturalLanguageConfigured("en-us") 257 @natural_language_configured.setter 258 def natural_language_configured(self, val): 259 raise ipp.errors.AttributesNotSettable("natural-language-configured") 227 260 228 261 @property 229 262 def generated_natural_language_supported(self): 230 263 return ipp.GeneratedNaturalLanguageSupported("en-us") 264 @generated_natural_language_supported.setter 265 def generated_natural_language_supported(self, val): 266 raise ipp.errors.AttributesNotSettable("generated-natural-language-supported") 231 267 232 268 @property 233 269 def document_format_default(self): 234 270 return ipp.DocumentFormatDefault("application/octet-stream") 271 @document_format_default.setter 272 def document_format_default(self, val): 273 raise ipp.errors.AttributesNotSettable("document-format-default") 235 274 236 275 @property 237 276 def document_format_supported(self): 238 277 return ipp.DocumentFormatSupported("application/octet-stream", "audio/mp3") 278 @document_format_supported.setter 279 def document_format_supported(self, val): 280 raise ipp.errors.AttributesNotSettable("document-format-supported") 239 281 240 282 @property 241 283 def printer_is_accepting_jobs(self): 242 284 return ipp.PrinterIsAcceptingJobs(True) 285 @printer_is_accepting_jobs.setter 286 def printer_is_accepting_jobs(self, val): 287 raise ipp.errors.AttributesNotSettable("printer-is-accepting-jobs") 243 288 244 289 @property 245 290 def queued_job_count(self): 246 291 return ipp.QueuedJobCount(len(self.active_jobs)) 292 @queued_job_count.setter 293 def queued_job_count(self, val): 294 raise ipp.errors.AttributesNotSettable("queued-job-count") 247 295 248 296 @property 249 297 def pdl_override_supported(self): 250 298 return ipp.PdlOverrideSupported("not-attempted") 299 @pdl_override_supported.setter 300 def pdl_override_supported(self, val): 301 raise ipp.errors.AttributesNotSettable("pdl-override-supported") 251 302 252 303 @property 253 304 def printer_up_time(self): 254 305 return ipp.PrinterUpTime(int(time.time()) - self.time_created) 306 @printer_up_time.setter 307 def printer_up_time(self, val): 308 raise ipp.errors.AttributesNotSettable("printer-up-time") 255 309 256 310 @property 257 311 def compression_supported(self): 258 312 return ipp.CompressionSupported("none") 313 @compression_supported.setter 314 def compression_supported(self, val): 315 raise ipp.errors.AttributesNotSettable("compression-supported") 259 316 260 317 @property 261 318 def multiple_operation_time_out(self): 262 319 return ipp.MultipleOperationTimeOut(240) 320 @multiple_operation_time_out.setter 321 def multiple_operation_time_out(self, val): 322 raise ipp.errors.AttributesNotSettable("multiple-operation-time-out") 263 323 264 324 @property 265 325 def multiple_document_jobs_supported(self): 266 326 return ipp.MultipleDocumentJobsSupported(False) 327 @multiple_document_jobs_supported.setter 328 def multiple_document_jobs_supported(self, val): 329 raise ipp.errors.AttributesNotSettable("multiple-document-jobs-supported") 267 330 268 331 ###################################################################### … … 389 452 return attributes 390 453 391 def set_printer_attributes(self): 392 pass 454 def set_printer_attributes(self, job_id, attributes): 455 for attr in attributes: 456 try: 457 setattr(self, attr, attributes[attr]) 458 except AttributeError: 459 raise ipp.errors.ClientErrorAttributes 393 460 394 461 def cancel_job(self, job_id, requesting_user_name=None): … … 408 475 job.spool(document) 409 476 410 def send_uri(self): 411 pass 477 def send_uri(self, job_id, document_uri, document_name=None, 478 document_format=None, document_natural_language=None, 479 requesting_user_name=None, compression=None, 480 last_document=None): 481 job = self.get_job(job_id) 482 # XXX: need to validate URI 483 # XXX: need to deal with the URI stream? 484 #job.spool_uri(document_uri) 412 485 413 486 def get_job_attributes(self, job_id, requested_attributes=None): … … 422 495 return attributes 423 496 424 def set_job_attributes(self): 425 pass 426 427 def restart_job(self): 428 pass 429 430 def promote_job(self): 431 pass 497 def set_job_attributes(self, job_id, attributes): 498 job = self.get_job(job_id) 499 for attr in attributes: 500 if attr in ("job-id", "job-k-octets", "job-state", "job-printer-uri"): 501 raise ipp.errors.ClientErrorAttributesNotSettable(attr) 502 elif attr == "job-name": 503 job.name = attributes[attr] 504 elif attr == "job-originating-user-name": 505 job.creator = attributes[attr] # XXX: do we want this? 506 507 def restart_job(self, job_id, requesting_user_name=None): 508 job = self.get_job(job_id) 509 try: 510 job.restart() 511 except InvalidJobStateException: 512 # XXX 513 raise ipp.errors.ClientErrorNotPossible 514 515 with self.lock: 516 self.finished_jobs.remove(job_id) 517 self.pending_jobs.append(job_id) 518 519 def promote_job(self, job_id, requesting_user_name=None): 520 # According to RFC 3998, we need to put the job at the front 521 # of the queue (so that when the currently playing job 522 # completes, this one will go next 523 524 job = self.get_job(job_id) 525 job.priority = 1 # XXX we need to actually do something 526 # correct here
Note: See TracChangeset
for help on using the changeset viewer.