Show
Ignore:
Timestamp:
04/30/03 21:53:58 (21 years ago)
Author:
jalet
Message:

1.05

Files:
1 modified

Legend:

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

    r976 r980  
    2121# 
    2222# $Log$ 
     23# Revision 1.26  2003/04/30 19:53:58  jalet 
     24# 1.05 
     25# 
    2326# Revision 1.25  2003/04/30 13:36:40  jalet 
    2427# Stupid accounting method was added. 
     
    200203           for its internal lifetime page counter. 
    201204        """    
    202         validaccounters = [ "querying", "stupid" ]      
    203         try : 
    204             accounter = self.getPrinterOption(printer, "accounter").lower() 
    205         except PyKotaConfigError :     
    206             accounter = "querying" 
    207         if accounter not in validaccounters : 
     205        validaccounters = [ "querying", "stupid", "external" ]      
     206        try : 
     207            fullaccounter = self.getPrinterOption(printer, "accounter").strip().lower() 
     208        except PyKotaConfigError :     
     209            fullaccounter = "querying" 
     210        if fullaccounter.startswith("external") :     
     211            try : 
     212                (accounter, args) = [x.strip() for x in fullaccounter.split('(', 1)] 
     213            except ValueError :     
     214                raise PyKotaConfigError, _("Invalid external accounter %s for printer %s") % (fullaccounter, printer) 
     215            if args.endswith(')') : 
     216                args = args[:-1] 
     217            if not args : 
     218                raise PyKotaConfigError, _("Invalid external accounter %s for printer %s") % (fullaccounter, printer) 
     219            return (accounter, args)     
     220        elif fullaccounter not in validaccounters : 
    208221            raise PyKotaConfigError, _("Option accounter in section %s only supports values in %s") % (printer, str(validaccounters)) 
    209         return accounter 
     222        else :     
     223            return (fullaccounter, None) 
    210224         
    211225    def getRequesterBackend(self, printer) :