Changeset 1152 for pykota/trunk/pykota
- Timestamp:
- 10/08/03 23:41:38 (21 years ago)
- Location:
- pykota/trunk/pykota
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/config.py
r1148 r1152 22 22 # 23 23 # $Log$ 24 # Revision 1.39 2003/10/08 21:41:38 jalet 25 # External policies for printers works ! 26 # We can now auto-add users on first print, and do other useful things if needed. 27 # 24 28 # Revision 1.38 2003/10/07 22:06:05 jalet 25 29 # Preliminary code to disable job history … … 320 324 def getPrinterPolicy(self, printer) : 321 325 """Returns the default policy for the current printer.""" 322 validpolicies = [ "ALLOW", "DENY" ] 323 try : 324 policy = self.getPrinterOption(printer, "policy").upper() 325 except PyKotaConfigError : 326 policy = "DENY" 327 if policy not in validpolicies : 328 raise PyKotaConfigError, _("Option policy in section %s only supports values in %s") % (printer, str(validpolicies)) 329 return policy 326 validpolicies = [ "ALLOW", "DENY", "EXTERNAL" ] 327 try : 328 fullpolicy = self.getPrinterOption(printer, "policy") 329 except PyKotaConfigError : 330 return ("DENY", None) 331 else : 332 try : 333 policy = [x.strip() for x in fullpolicy.split('(', 1)] 334 except ValueError : 335 raise PyKotaConfigError, _("Invalid policy %s for printer %s") % (fullpolicy, printer) 336 if len(policy) == 1 : 337 policy.append("") 338 (policy, args) = policy 339 if args.endswith(')') : 340 args = args[:-1] 341 policy = policy.upper() 342 if (policy == "EXTERNAL") and not args : 343 raise PyKotaConfigError, _("Invalid policy %s for printer %s") % (fullpolicy, printer) 344 if policy not in validpolicies : 345 raise PyKotaConfigError, _("Option policy in section %s only supports values in %s") % (printer, str(validpolicies)) 346 return (policy, args) 330 347 331 348 def getSMTPServer(self) : -
pykota/trunk/pykota/tool.py
r1144 r1152 22 22 # 23 23 # $Log$ 24 # Revision 1.53 2003/10/08 21:41:38 jalet 25 # External policies for printers works ! 26 # We can now auto-add users on first print, and do other useful things if needed. 27 # 24 28 # Revision 1.52 2003/10/07 09:07:28 jalet 25 29 # Character encoding added to please latest version of Python … … 435 439 436 440 # then we check the user's own quota 437 policy = self.config.getPrinterPolicy(printer.Name) 441 # if we get there we are sure that policy is not EXTERNAL 442 (policy, dummy) = self.config.getPrinterPolicy(printer.Name) 438 443 if user.LimitBy and (user.LimitBy.lower() == "balance") : 439 444 if user.AccountBalance is None : -
pykota/trunk/pykota/version.py
r1149 r1152 22 22 # 23 23 24 __version__ = "1.15alpha 8_unofficial"24 __version__ = "1.15alpha9_unofficial" 25 25 26 26 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""