Changeset 3086
- Timestamp:
- 11/30/06 18:13:31 (18 years ago)
- Location:
- pykota/trunk
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/NEWS
r3084 r3086 22 22 PyKota NEWS : 23 23 24 - 1.25alpha18 (2006-11-30) : 25 26 - Fixed a severe bug in the LDAP backend wrt the overcharging factor. 27 24 28 - 1.25alpha17 (2006-11-27) : 25 29 -
pykota/trunk/pykota/storages/ldapstorage.py
r3056 r3086 358 358 user = StorageUser(self, username) 359 359 username = self.userCharsetToDatabase(username) 360 result = self.doSearch("(&(objectClass=pykotaAccount)(|(pykotaUserName=%s)(%s=%s)))" % (username, self.info["userrdn"], username), ["pykotaUserName", "pykotaLimitBy", self.info["usermail"], " pykotaOverCharge", "description"], base=self.info["userbase"])360 result = self.doSearch("(&(objectClass=pykotaAccount)(|(pykotaUserName=%s)(%s=%s)))" % (username, self.info["userrdn"], username), ["pykotaUserName", "pykotaLimitBy", self.info["usermail"], "description"], base=self.info["userbase"]) 361 361 if result : 362 362 fields = result[0][1] … … 365 365 user.Email = fields.get(self.info["usermail"], [None])[0] 366 366 user.LimitBy = fields.get("pykotaLimitBy", ["quota"])[0] 367 user.OverCharge = float(fields.get("pykotaOverCharge", [1.0])[0]) 368 result = self.doSearch("(&(objectClass=pykotaAccountBalance)(|(pykotaUserName=%s)(%s=%s)))" % (username, self.info["balancerdn"], username), ["pykotaBalance", "pykotaLifeTimePaid", "pykotaPayments"], base=self.info["balancebase"]) 367 result = self.doSearch("(&(objectClass=pykotaAccountBalance)(|(pykotaUserName=%s)(%s=%s)))" % (username, self.info["balancerdn"], username), ["pykotaBalance", "pykotaLifeTimePaid", "pykotaPayments", "pykotaOverCharge"], base=self.info["balancebase"]) 369 368 if not result : 370 369 raise PyKotaStorageError, _("No pykotaAccountBalance object found for user %s. Did you create LDAP entries manually ?") % username … … 380 379 user.AccountBalance = user.AccountBalance or 0.0 381 380 user.LifeTimePaid = fields.get("pykotaLifeTimePaid") 381 user.OverCharge = float(fields.get("pykotaOverCharge", [1.0])[0]) 382 382 if user.LifeTimePaid is not None : 383 383 if user.LifeTimePaid[0].upper() == "NONE" : … … 725 725 # see comment at the same place in pgstorage.py 726 726 result = self.doSearch("objectClass=pykotaAccount", \ 727 ["pykotaUserName", "pykotaLimitBy", self.info["usermail"], " pykotaOverCharge", "description"], \727 ["pykotaUserName", "pykotaLimitBy", self.info["usermail"], "description"], \ 728 728 base=self.info["userbase"]) 729 729 if result : … … 743 743 user.Email = fields.get(self.info["usermail"], [None])[0] 744 744 user.LimitBy = fields.get("pykotaLimitBy", ["quota"])[0] 745 user.OverCharge = float(fields.get("pykotaOverCharge", [1.0])[0])746 745 user.Description = self.databaseToUserCharset(fields.get("description", [""])[0]) 747 746 uname = self.userCharsetToDatabase(username) 748 747 result = self.doSearch("(&(objectClass=pykotaAccountBalance)(|(pykotaUserName=%s)(%s=%s)))" % \ 749 748 (uname, self.info["balancerdn"], uname), \ 750 ["pykotaBalance", "pykotaLifeTimePaid", "pykotaPayments" ], \749 ["pykotaBalance", "pykotaLifeTimePaid", "pykotaPayments", "pykotaOverCharge"], \ 751 750 base=self.info["balancebase"]) 752 751 if not result : … … 755 754 fields = result[0][1] 756 755 user.idbalance = result[0][0] 756 user.OverCharge = float(fields.get("pykotaOverCharge", [1.0])[0]) 757 757 user.AccountBalance = fields.get("pykotaBalance") 758 758 if user.AccountBalance is not None : … … 916 916 "pykotaUserName" : uname, 917 917 "pykotaLimitBy" : (user.LimitBy or "quota"), 918 "pykotaOverCharge" : str(user.OverCharge),919 918 "description" : self.userCharsetToDatabase(user.Description or ""), 920 919 self.info["usermail"] : user.Email or "", … … 937 936 fields.update(newfields) 938 937 fields.update({ "pykotaBalance" : str(user.AccountBalance or 0.0), 938 "pykotaOverCharge" : str(user.OverCharge), 939 939 "pykotaLifeTimePaid" : str(user.LifeTimePaid or 0.0), }) 940 940 self.doModify(dn, fields) … … 953 953 "cn" : uname, 954 954 "pykotaBalance" : str(user.AccountBalance or 0.0), 955 "pykotaOverCharge" : str(user.OverCharge), 955 956 "pykotaLifeTimePaid" : str(user.LifeTimePaid or 0.0), 956 957 } … … 968 969 "cn" : uname, 969 970 "pykotaBalance" : str(user.AccountBalance or 0.0), 971 "pykotaOverCharge" : str(user.OverCharge), 970 972 "pykotaLifeTimePaid" : str(user.LifeTimePaid or 0.0), 971 973 } … … 1120 1122 newfields = { 1121 1123 "pykotaLimitBy" : (user.LimitBy or "quota"), 1122 "pykotaOverCharge" : str(user.OverCharge),1123 1124 "description" : self.userCharsetToDatabase(user.Description or ""), 1124 1125 self.info["usermail"] : user.Email or "", … … 1128 1129 newfields = { "pykotaBalance" : str(user.AccountBalance or 0.0), 1129 1130 "pykotaLifeTimePaid" : str(user.LifeTimePaid or 0.0), 1131 "pykotaOverCharge" : str(user.OverCharge), 1130 1132 } 1131 1133 self.doModify(user.idbalance, newfields) … … 1591 1593 entries = [u for u in [self.getUser(name) for name in self.getAllUsersNames(uname)] if u.Exists] 1592 1594 if entries : 1593 result = [ ("dn", "username", "balance", "lifetimepaid", "limitby", "email", "description" ) ]1595 result = [ ("dn", "username", "balance", "lifetimepaid", "limitby", "email", "description", "overcharge") ] 1594 1596 for entry in entries : 1595 result.append((entry.ident, entry.Name, entry.AccountBalance, entry.LifeTimePaid, entry.LimitBy, entry.Email, entry.Description ))1597 result.append((entry.ident, entry.Name, entry.AccountBalance, entry.LifeTimePaid, entry.LimitBy, entry.Email, entry.Description, entry.OverCharge)) 1596 1598 return result 1597 1599 -
pykota/trunk/pykota/version.py
r3073 r3086 22 22 # 23 23 24 __version__ = "1.25alpha1 7_unofficial"24 __version__ = "1.25alpha18_unofficial" 25 25 26 26 __doc__ = "PyKota : a complete Printing Quota Solution for CUPS."