Changeset 2895 for pykota/trunk/bin/cupspykota
- Timestamp:
- 05/23/06 23:28:39 (18 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/cupspykota
r2891 r2895 371 371 self.logdebug("Job's attributes sanitizing done.") 372 372 373 def didUserConfirm(self) : 374 """Asks for user confirmation through an external script. 375 376 returns False if the end user wants to cancel the job, else True. 377 """ 378 self.logdebug("Checking if we have to ask for user's confirmation...") 379 answer = None 380 confirmationcommand = self.config.getAskConfirmation(self.PrinterName) 381 if confirmationcommand : 382 self.logdebug("Launching subprocess [%s] to ask for user confirmation." \ 383 % confirmationcommand) 384 inputfile = os.popen(confirmationcommand, "r") 385 try : 386 for answer in inputfile.xreadlines() : 387 answer = answer.strip().upper() 388 if answer == "CANCEL" : 389 break 390 except IOError, msg : 391 self.logdebug("IOError while reading subprocess' output : %s" % msg) 392 inputfile.close() 393 self.logdebug("User's confirmation received : %s" % (((answer == "CANCEL") and "CANCEL") or "CONTINUE")) 394 else : 395 self.logdebug("No need to ask for user's confirmation, job processing will continue.") 396 return (answer != "CANCEL") 397 373 398 def overwriteJobTicket(self) : 374 399 """Should we overwrite the job's ticket (username and billingcode) ?""" 375 400 self.logdebug("Checking if we need to overwrite the job ticket...") 376 401 jobticketcommand = self.config.getOverwriteJobTicket(self.PrinterName) 377 if jobticketcommand is not None:402 if jobticketcommand : 378 403 username = billingcode = action = None 379 404 self.logdebug("Launching subprocess [%s] to overwrite the job ticket." \ … … 1020 1045 1021 1046 if self.Action not in ("DENY", "CANCEL") : 1047 if not self.didUserConfirm() : 1048 self.Action = "CANCEL" 1049 self.Reason = _("Print job cancelled.") 1050 os.environ["PYKOTASTATUS"] = "CANCELLED" 1051 1052 if self.Action not in ("DENY", "CANCEL") : 1022 1053 if self.Printer.MaxJobSize and (self.softwareJobSize > self.Printer.MaxJobSize) : 1023 1054 # This printer was set to refuse jobs this large.