Show
Ignore:
Timestamp:
07/25/05 19:13:11 (19 years ago)
Author:
jerome
Message:

Added two new directives :

unknown_billingcode : defines what to do when printing if the billing code

used is not present in the database.

overwrite_jobticket : defines a command to launch when overwriting the username

or the billing code used is desirable (for example when
an user interaction should take place, see the work
of George Farris)

Severity : no support for this in the backend right now, so be patient (again).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/config.py

    r2370 r2385  
    205205            return      # No prefix to strip off 
    206206             
     207    def getOverwriteJobTicket(self, printername) :         
     208        """Returns the overwrite_jobticket directive's content, or None if unset.""" 
     209        try : 
     210            return self.getPrinterOption(printername, "overwrite_jobticket").strip() 
     211        except PyKotaConfigError :     
     212            return      # No overwriting will be done 
     213         
     214    def getUnknownBillingCode(self, printername) :         
     215        """Returns the unknown_billingcode directive's content, or the default value if unset.""" 
     216        validvalues = [ "CREATE", "DENY" ] 
     217        try : 
     218            fullvalue = self.getPrinterOption(printername, "unknown_billingcode") 
     219        except PyKotaConfigError :     
     220            return ("CREATE", None) 
     221        else :     
     222            try : 
     223                value = [x.strip() for x in fullvalue.split('(', 1)] 
     224            except ValueError :     
     225                raise PyKotaConfigError, _("Invalid unknown_billingcode directive %s for printer %s") % (fullvalue, printername) 
     226            if len(value) == 1 :     
     227                value.append("") 
     228            (value, args) = value     
     229            if args.endswith(')') : 
     230                args = args[:-1] 
     231            value = value.upper()     
     232            if (value == "DENY") and not args : 
     233                return ("DENY", None) 
     234            if value not in validvalues : 
     235                raise PyKotaConfigError, _("Directive unknown_billingcode in section %s only supports values in %s") % (printername, str(validvalues)) 
     236            return (value, args) 
     237         
    207238    def getPrinterEnforcement(self, printername) :     
    208239        """Returns if quota enforcement should be strict or laxist for the current printer."""