Changeset 3146

Show
Ignore:
Timestamp:
02/20/07 23:36:46 (17 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.

Location:
pykota/trunk
Files:
2 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 : 
  • pykota/trunk/conf/pykota.conf.sample

    r3133 r3146  
    455455#    USERNAME=the_username_we_want_to_overwrite_with 
    456456#    BILLINGCODE=the_billingcode_we_want_to_overwrite_with 
     457#    REASON=reason_we_chose_deny_or_cancel 
    457458#    AUTH=NO (equivalent to DENY below) 
    458459#    DENY  
     
    467468# used unchanged. 
    468469# If DENY or CANCEL is output, neither the username nor the 
    469 # billing code can be overwritten. 
     470# billing code can be overwritten.  
     471# If REASON is output, that will be used in the notification in the case of  
     472# DENY or CANCEL. Otherwise, the built-in reasons will be used. 
    470473# 
    471474# This value can be set either globally or on a per printer basis