Changeset 3146 for pykota/trunk/bin

Show
Ignore:
Timestamp:
02/20/07 23:36:46 (18 years ago)
Author:
matt
Message:

Allow overwrite_jobticket scripts to output a REASON= line to change the default reason a job was denied or cancelled.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/cupspykota

    r3141 r3146  
    438438        jobticketcommand = self.config.getOverwriteJobTicket(self.PrinterName) 
    439439        if jobticketcommand : 
    440             username = billingcode = action = None 
     440            username = billingcode = action = reason = None 
    441441            self.logdebug("Launching subprocess [%s] to overwrite the job ticket." \ 
    442442                                     % jobticketcommand) 
     
    458458                        billingcode = self.userCharsetToUTF8(line.split("=", 1)[1].strip()) 
    459459                        self.logdebug("Seen new billing code [%s]" % billingcode) 
     460                    elif line.startswith("REASON=") : 
     461                        reason = self.userCharsetToUTF8(line.split("=", 1)[1].strip()) 
     462                        self.logdebug("Seen new reason [%s]" % reason) 
    460463            except IOError, msg :             
    461464                self.logdebug("IOError while reading subprocess' output : %s" % msg) 
     
    466469            if action == "DENY" : 
    467470                self.Action = action 
    468                 self.Reason = _("You are not allowed to print at this time.") 
     471                self.Reason = (reason or _("You are not allowed to print at this time.")) 
    469472            elif action == "CANCEL" : 
    470473                self.Action = action 
    471                 self.Reason = _("Print job cancelled.") 
     474                self.Reason = (reason or _("Print job cancelled.")) 
    472475                os.environ["PYKOTASTATUS"] = "CANCELLED" 
    473476            else :