Changeset 2583

Show
Ignore:
Timestamp:
11/13/05 23:37:22 (18 years ago)
Author:
jerome
Message:

Preliminary work on the "onbackenderror" directive.

Location:
pykota/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/conf/pykota.conf.sample

    r2576 r2583  
    300300# [global] section. 
    301301privacy : no 
     302 
     303# When the real CUPS backend fail, should we modify the 
     304# user's page counters and account balance or not ? 
     305# If you trust your users, set it to "nocharge". 
     306# If you think they found some mean to kill the real CUPS backend,  
     307# then set it to "charge". 
     308# If unset, the default value is "nocharge", meaning that users won't be 
     309# charged whenever a CUPS backend fails. This is the OPPOSITE 
     310# behavior compared to PyKota versions prior to 1.24alpha2. 
     311# This value can be set either globally or on a per printer basis 
     312# If both are defined, the printer option has priority. 
     313# onbackenderror : charge 
     314onbackenderror : nocharge 
    302315 
    303316# Should we strip off some characters from the beginning of 
  • pykota/trunk/pykota/config.py

    r2422 r2583  
    268268            return enforcement     
    269269             
     270    def getPrinterOnBackendError(self, printername) :     
     271        """Returns what must be done whenever the real CUPS backend fails.""" 
     272        validactions = [ "CHARGE", "NOCHARGE" ]      
     273        try : 
     274            action = self.getPrinterOption(printername, "onbackenderror") 
     275        except PyKotaConfigError :     
     276            return "NOCHARGE" 
     277        else :     
     278            action = action.upper() 
     279            if action not in validactions : 
     280                raise PyKotaConfigError, _("Option onbackenderror in section %s only supports values in %s") % (printername, str(validactions)) 
     281            return action   
     282             
    270283    def getPrinterOnAccounterError(self, printername) :     
    271284        """Returns what must be done whenever the accounter fails."""