Changeset 1483 for pykota/trunk/pykota/config.py
- Timestamp:
- 05/18/04 16:49:34 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/config.py
r1475 r1483 22 22 # 23 23 # $Log$ 24 # Revision 1.47 2004/05/18 14:49:20 jalet 25 # Big code changes to completely remove the need for "requester" directives, 26 # jsut use "hardware(... your previous requester directive's content ...)" 27 # 24 28 # Revision 1.46 2004/05/13 13:59:28 jalet 25 29 # Code simplifications … … 311 315 validaccounters = [ "hardware", "software" ] 312 316 fullaccounter = self.getPrinterOption(printername, "accounter").strip() 313 if fullaccounter.lower().startswith("software") : 317 flower = fullaccounter.lower() 318 if flower.startswith("software") or flower.startswith("hardware") : 314 319 try : 315 320 (accounter, args) = [x.strip() for x in fullaccounter.split('(', 1)] 316 321 except ValueError : 317 raise PyKotaConfigError, _("Invalid externalaccounter %s for printer %s") % (fullaccounter, printername)322 raise PyKotaConfigError, _("Invalid accounter %s for printer %s") % (fullaccounter, printername) 318 323 if args.endswith(')') : 319 324 args = args[:-1] 320 325 if not args : 321 raise PyKotaConfigError, _("Invalid externalaccounter %s for printer %s") % (fullaccounter, printername)326 raise PyKotaConfigError, _("Invalid accounter %s for printer %s") % (fullaccounter, printername) 322 327 return (accounter.lower(), args) 323 el if fullaccounter.lower() not in validaccounters:328 else : 324 329 raise PyKotaConfigError, _("Option accounter in section %s only supports values in %s") % (printername, str(validaccounters)) 325 else :326 return (fullaccounter.lower(), None)327 330 328 331 def getPreHook(self, printername) : … … 340 343 return # No command to launch in the post-hook 341 344 342 def getRequesterBackend(self, printername) :343 """Returns the requester backend to use for a given printer, with its arguments."""344 try :345 fullrequester = self.getPrinterOption(printername, "requester")346 except PyKotaConfigError :347 # No requester defined, maybe it is not needed if accounting method348 # is not set to 'hardware', but if we are called, then the accounting349 # method really IS 'hardware', and so there's a big problem.350 raise PyKotaConfigError, _("Option requester for printer %s was not set") % printername351 else :352 try :353 (requester, args) = [x.strip() for x in fullrequester.split('(', 1)]354 except ValueError :355 raise PyKotaConfigError, _("Invalid requester %s for printer %s") % (fullrequester, printername)356 if args.endswith(')') :357 args = args[:-1]358 if not args :359 raise PyKotaConfigError, _("Invalid requester %s for printer %s") % (fullrequester, printername)360 validrequesters = [ "external" ]361 requester = requester.lower()362 if requester not in validrequesters :363 raise PyKotaConfigError, _("Option requester for printer %s only supports values in %s") % (printername, str(validrequesters))364 return (requester, args)365 366 345 def getPrinterPolicy(self, printername) : 367 346 """Returns the default policy for the current printer."""