Changeset 2054 for pykota/trunk/pykota/tool.py
- Timestamp:
- 02/13/05 23:02:29 (19 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/tool.py
r2008 r2054 22 22 # 23 23 # $Log$ 24 # Revision 1.149 2005/02/13 22:02:29 jalet 25 # Big database structure changes. Upgrade script is now included as well as 26 # the new LDAP schema. 27 # Introduction of the -o | --overcharge command line option to edpykota. 28 # The output of repykota is more complete, but doesn't fit in 80 columns anymore. 29 # Introduction of the new 'maxdenybanners' directive. 30 # 24 31 # Revision 1.148 2005/01/06 23:24:21 jalet 25 32 # Regain priviledge the time to open the job's data file when printing in … … 1012 1019 return action 1013 1020 else : 1014 val = float(user.AccountBalance or 0.0) 1015 enforcement = self.config.getPrinterEnforcement(printer.Name) 1016 if enforcement == "STRICT" : 1017 val -= self.softwareJobPrice # use precomputed size. 1018 if val <= 0.0 : 1019 action = "DENY" 1020 elif val <= self.config.getPoorMan() : 1021 action = "WARN" 1021 if user.OverCharge == 0.0 : 1022 self.printInfo(_("User %s will not be charged for printing.") % user.Name) 1023 action = "ALLOW" 1022 1024 else : 1023 action = "ALLOW" 1024 if (enforcement == "STRICT") and (val == 0.0) : 1025 action = "WARN" # we can still print until account is 0 1025 val = float(user.AccountBalance or 0.0) 1026 enforcement = self.config.getPrinterEnforcement(printer.Name) 1027 if enforcement == "STRICT" : 1028 val -= self.softwareJobPrice # use precomputed size. 1029 if val <= 0.0 : 1030 action = "DENY" 1031 elif val <= self.config.getPoorMan() : 1032 action = "WARN" 1033 else : 1034 action = "ALLOW" 1035 if (enforcement == "STRICT") and (val == 0.0) : 1036 action = "WARN" # we can still print until account is 0 1026 1037 return action 1027 1038 else : … … 1106 1117 if action.startswith("POLICY_") : 1107 1118 action = action[7:] 1119 1108 1120 if action == "DENY" : 1109 1121 adminmessage = _("Print Quota exceeded for user %s on printer %s") % (user.Name, printer.Name) … … 1286 1298 def exportUserInfo(self, userpquota) : 1287 1299 """Exports user information to the environment.""" 1300 os.environ["PYKOTAOVERCHARGE"] = str(userpquota.User.OverCharge) 1288 1301 os.environ["PYKOTALIMITBY"] = str(userpquota.User.LimitBy) 1289 1302 os.environ["PYKOTABALANCE"] = str(userpquota.User.AccountBalance or 0.0) … … 1294 1307 os.environ["PYKOTAHARDLIMIT"] = str(userpquota.HardLimit) 1295 1308 os.environ["PYKOTADATELIMIT"] = str(userpquota.DateLimit) 1309 os.environ["PYKOTAWARNCOUNT"] = str(userpquota.WarnCount) 1296 1310 1297 1311 # not really an user information, but anyway