Changeset 57bc2dc
- Timestamp:
- Jan 21, 2012, 5:20:10 PM (12 years ago)
- Branches:
- no-cups
- Children:
- 1b6dc13, 441604f
- Parents:
- f0807b8
- git-author:
- Jessica B. Hamrick <jhamrick@…> (01/21/12 17:19:59)
- git-committer:
- Jessica B. Hamrick <jhamrick@…> (01/21/12 17:20:10)
- Location:
- server/lib/gutenbach/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
server/lib/gutenbach/server/job.py
r9225351 r57bc2dc 53 53 """ 54 54 return cmp(self.priority, other.priority) 55 56 def __del__(self): 57 if self.player: 58 self.player.mplayer_stop() 59 self.player = None 60 if self.document and not self.document.closed: 61 self.document.close() 62 self.document = None 63 64 self.id = None 65 self.creator = None 66 self.name = None 67 self.priority = None 68 self._why_done = None 55 69 56 70 ###################################################################### … … 259 273 if not hasattr(document, "close"): 260 274 raise errors.InvalidDocument, "no close attribute" 275 if not hasattr(document, "closed"): 276 raise errors.InvalidDocument, "no closed attribute" 261 277 262 278 def spool(self, document=None): -
server/lib/gutenbach/server/printer.py
r9225351 r57bc2dc 9 9 import traceback 10 10 import sys 11 import tempfile 11 12 from . import sync 12 13 … … 361 362 ###################################################################### 362 363 363 def print_job(self): 364 pass 365 366 def validate_job(self): 367 pass 364 def print_job(self, document, document_name=None, document_format=None, 365 document_natural_language=None, requesting_user_name=None, 366 compression=None, job_name=None, job_k_octets=None): 367 368 # create the job 369 job_id = self.create_job( 370 requesting_user_name=requesting_user_name, 371 job_name=job_name, 372 job_k_octets=job_k_octets) 373 374 # send the document 375 self.send_document( 376 job_id, 377 document, 378 document_name=document_name, 379 document_format=document_format, 380 document_natural_language=document_natural_language, 381 requesting_user_name=requesting_user_name, 382 compression=compression, 383 last_document=False) 384 385 return job_id 386 387 def verify_job(self, document_name=None, document_format=None, 388 document_natural_language=None, requesting_user_name=None, 389 compression=None, job_name=None, job_k_octets=None): 390 391 job_id = self._next_job_id 392 job = GutenbachJob( 393 job_id, 394 creator=requesting_user_name, 395 name=job_name) 396 job.spool(tempfile.TemporaryFile()) 397 job.abort() 398 del job 368 399 369 400 def get_jobs(self, requesting_user_name=None, which_jobs=None, … … 397 428 pass 398 429 399 def create_job(self, requesting_user_name=None, job_name=None, job_k_octets=None): 430 def create_job(self, requesting_user_name=None, job_name=None, 431 job_k_octets=None): 432 400 433 job_id = self._next_job_id 401 434 self._next_job_id += 1 … … 405 438 creator=requesting_user_name, 406 439 name=job_name) 407 440 408 441 self.jobs[job_id] = job 409 442 self.pending_jobs.append(job_id) … … 425 458 self.paused = True 426 459 427 428 429 460 @sync 430 461 def resume_printer(self): … … 441 472 self.paused = False 442 473 474 @sync 443 475 def get_printer_attributes(self, requested_attributes=None): 444 476 if requested_attributes is None: … … 452 484 return attributes 453 485 486 @sync 454 487 def set_printer_attributes(self, job_id, attributes): 455 488 for attr in attributes: … … 459 492 raise ipp.errors.ClientErrorAttributes 460 493 494 @sync 461 495 def cancel_job(self, job_id, requesting_user_name=None): 462 496 job = self.get_job(job_id) … … 467 501 raise 468 502 503 @sync 469 504 def send_document(self, job_id, document, document_name=None, 470 505 document_format=None, document_natural_language=None, … … 475 510 job.spool(document) 476 511 512 @sync 477 513 def send_uri(self, job_id, document_uri, document_name=None, 478 514 document_format=None, document_natural_language=None, … … 484 520 #job.spool_uri(document_uri) 485 521 522 @sync 486 523 def get_job_attributes(self, job_id, requested_attributes=None): 487 524 if requested_attributes is None: … … 495 532 return attributes 496 533 534 @sync 497 535 def set_job_attributes(self, job_id, attributes): 498 536 job = self.get_job(job_id) … … 504 542 elif attr == "job-originating-user-name": 505 543 job.creator = attributes[attr] # XXX: do we want this? 506 544 545 @sync 507 546 def restart_job(self, job_id, requesting_user_name=None): 508 547 job = self.get_job(job_id) … … 513 552 raise ipp.errors.ClientErrorNotPossible 514 553 515 with self.lock:516 self.finished_jobs.remove(job_id)517 self.pending_jobs.append(job_id) 518 554 self.finished_jobs.remove(job_id) 555 self.pending_jobs.append(job_id) 556 557 @sync 519 558 def promote_job(self, job_id, requesting_user_name=None): 520 559 # According to RFC 3998, we need to put the job at the front
Note: See TracChangeset
for help on using the changeset viewer.