Changeset 3549 for pykota/trunk/pykota/storages/ldapstorage.py
- Timestamp:
- 08/18/10 04:20:57 (14 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/ldapstorage.py
r3532 r3549 447 447 printer.PricePerJob = float(fields.get("pykotaPricePerJob", [0.0])[0]) 448 448 printer.PricePerPage = float(fields.get("pykotaPricePerPage", [0.0])[0]) 449 printer.MaxJobSize = int(fields.get("pykotaMaxJobSize", [0])[0]) 449 printer.MaxJobSize = fields.get("pykotaMaxJobSize") 450 if printer.MaxJobSize is not None : 451 if printer.MaxJobSize[0].upper() == "NONE" : 452 printer.MaxJobSize = None 453 else : 454 printer.MaxJobSize = int(printer.MaxJobSize[0]) 450 455 printer.PassThrough = fields.get("pykotaPassThrough", [None])[0] 451 456 if printer.PassThrough in (1, "1", "t", "true", "TRUE", "True") : … … 513 518 result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaGroupName=%s)(pykotaPrinterName=%s))" % \ 514 519 (unicodeToDatabase(group.Name), unicodeToDatabase(printer.Name)), \ 515 ["pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit" , "pykotaMaxJobSize"], \520 ["pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], \ 516 521 base=base) 517 522 if result : … … 536 541 else : 537 542 grouppquota.DateLimit = grouppquota.DateLimit[0] 538 grouppquota.MaxJobSize = fields.get("pykotaMaxJobSize")539 if grouppquota.MaxJobSize is not None :540 if grouppquota.MaxJobSize[0].upper() == "NONE" :541 grouppquota.MaxJobSize = None542 else :543 grouppquota.MaxJobSize = int(grouppquota.MaxJobSize[0])544 543 grouppquota.PageCounter = 0 545 544 grouppquota.LifePageCounter = 0 … … 712 711 printer.PricePerJob = float(fields.get("pykotaPricePerJob", [0.0])[0] or 0.0) 713 712 printer.PricePerPage = float(fields.get("pykotaPricePerPage", [0.0])[0] or 0.0) 714 printer.MaxJobSize = int(fields.get("pykotaMaxJobSize", [0])[0]) 713 printer.MaxJobSize = fields.get("pykotaMaxJobSize") 714 if printer.MaxJobSize is not None : 715 if printer.MaxJobSize[0].upper() == "NONE" : 716 printer.MaxJobSize = None 717 else : 718 printer.MaxJobSize = int(printer.MaxJobSize[0]) 715 719 printer.PassThrough = fields.get("pykotaPassThrough", [None])[0] 716 720 if printer.PassThrough in (1, "1", "t", "true", "TRUE", "True") : … … 892 896 "pykotaPrinterName" : printername, 893 897 "pykotaPassThrough" : (printer.PassThrough and "t") or "f", 894 "pykotaMaxJobSize" : str(printer.MaxJobSize or 0),898 "pykotaMaxJobSize" : str(printer.MaxJobSize), 895 899 "description" : unicodeToDatabase(printer.Description or ""), 896 900 "pykotaPricePerPage" : str(printer.PricePerPage or 0.0), … … 1070 1074 "pykotaLifePageCounter" : str(upq.LifePageCounter or 0), 1071 1075 "pykotaWarnCount" : str(upq.WarnCount or 0), 1072 "pykotaMaxJobSize" : str(upq.MaxJobSize or 0),1076 "pykotaMaxJobSize" : str(upq.MaxJobSize), 1073 1077 } 1074 1078 if self.info["userquotabase"].lower() == "user" : … … 1106 1110 fields = { 1107 1111 "pykotaPassThrough" : (printer.PassThrough and "t") or "f", 1108 "pykotaMaxJobSize" : str(printer.MaxJobSize or 0),1112 "pykotaMaxJobSize" : str(printer.MaxJobSize), 1109 1113 "description" : unicodeToDatabase(printer.Description or ""), 1110 1114 "pykotaPricePerPage" : str(printer.PricePerPage or 0.0), … … 1251 1255 "pykotaPageCounter" : str(userpquota.PageCounter or 0), 1252 1256 "pykotaLifePageCounter" : str(userpquota.LifePageCounter or 0), 1253 "pykotaMaxJobSize" : str(userpquota.MaxJobSize or 0),1257 "pykotaMaxJobSize" : str(userpquota.MaxJobSize), 1254 1258 } 1255 1259 self.doModify(userpquota.ident, fields) … … 1275 1279 "pykotaHardLimit" : str(grouppquota.HardLimit), 1276 1280 "pykotaDateLimit" : str(grouppquota.DateLimit), 1277 "pykotaMaxJobSize" : str(grouppquota.MaxJobSize or 0),1278 1281 } 1279 1282 self.doModify(grouppquota.ident, fields) … … 1680 1683 entries = [p for p in [self.getPrinter(name) for name in self.getAllPrintersNames(pname)] if p.Exists] 1681 1684 if entries : 1682 fields = ("username", "printername", "dn", "userdn", "printerdn", "lifepagecounter", "pagecounter", "softlimit", "hardlimit", "datelimit" )1685 fields = ("username", "printername", "dn", "userdn", "printerdn", "lifepagecounter", "pagecounter", "softlimit", "hardlimit", "datelimit", "maxjobsize") 1683 1686 result = [] 1684 1687 uname = extractonly.get("username") 1685 1688 for entry in entries : 1686 1689 for (user, userpquota) in self.getPrinterUsersAndQuotas(entry, names=[uname or "*"]) : 1687 result.append((user.Name, entry.Name, userpquota.ident, user.ident, entry.ident, userpquota.LifePageCounter, userpquota.PageCounter, userpquota.SoftLimit, userpquota.HardLimit, userpquota.DateLimit ))1690 result.append((user.Name, entry.Name, userpquota.ident, user.ident, entry.ident, userpquota.LifePageCounter, userpquota.PageCounter, userpquota.SoftLimit, userpquota.HardLimit, userpquota.DateLimit, userpquota.MaxJobSize)) 1688 1691 return [fields] + self.sortRecords(fields, result, ["+userdn"], ordering) 1689 1692