Show
Ignore:
Timestamp:
01/31/06 12:32:34 (18 years ago)
Author:
jerome
Message:

Introduced the 'preaccounter' directive.

Files:
1 modified

Legend:

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

    r2622 r2635  
    190190        return url.strip()            
    191191     
     192    def getPreAccounterBackend(self, printername) :     
     193        """Returns the preaccounter backend to use for a given printer.""" 
     194        validaccounters = [ "software" ]      
     195        try : 
     196            fullaccounter = self.getPrinterOption(printername, "preaccounter").strip() 
     197        except PyKotaConfigError :     
     198            return ("software", "") 
     199        else :     
     200            flower = fullaccounter.lower() 
     201            if flower.startswith("software") :     
     202                try : 
     203                    (accounter, args) = [x.strip() for x in fullaccounter.split('(', 1)] 
     204                except ValueError :     
     205                    raise PyKotaConfigError, _("Invalid preaccounter %s for printer %s") % (fullaccounter, printername) 
     206                if args.endswith(')') : 
     207                    args = args[:-1].strip() 
     208                return ("software", args) 
     209            else : 
     210                raise PyKotaConfigError, _("Option preaccounter in section %s only supports values in %s") % (printername, str(validaccounters)) 
     211         
    192212    def getAccounterBackend(self, printername) :     
    193         """Returns the accounter backend to use for a given printer. 
    194          
    195            if it is not set, it defaults to 'hardware' which means ask printer 
    196            for its internal lifetime page counter. 
    197         """    
     213        """Returns the accounter backend to use for a given printer.""" 
    198214        validaccounters = [ "hardware", "software" ]      
    199215        fullaccounter = self.getPrinterOption(printername, "accounter").strip()