Changeset 2768 for pykota/trunk/pykota/storages/ldapstorage.py
- Timestamp:
- 03/01/06 10:47:49 (18 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/ldapstorage.py
r2765 r2768 887 887 return groupsandquotas 888 888 889 def addPrinter(self, printername) : 890 """Adds a printer to the quota storage, returns it.""" 891 printername = self.userCharsetToDatabase(printername) 889 def addPrinter(self, printer) : 890 """Adds a printer to the quota storage, returns the old value if it already exists.""" 891 oldentry = self.getPrinter(printer.Name) 892 if oldentry.Exists : 893 return oldentry # we return the existing entry 894 printername = self.userCharsetToDatabase(printer.Name) 892 895 fields = { self.info["printerrdn"] : printername, 893 896 "objectClass" : ["pykotaObject", "pykotaPrinter"], 894 897 "cn" : printername, 895 898 "pykotaPrinterName" : printername, 896 "pykotaPricePerPage" : "0.0", 897 "pykotaPricePerJob" : "0.0", 898 "pykotaMaxJobSize" : "0", 899 "pykotaPassThrough" : "0", 899 "pykotaPassThrough" : (printer.PassThrough and "t") or "f", 900 "pykotaMaxJobSize" : str(printer.MaxJobSize or 0), 901 "description" : self.userCharsetToDatabase(printer.Description or ""), 902 "pykotaPricePerPage" : str(printer.PricePerPage or 0.0), 903 "pykotaPricePerJob" : str(printer.PricePerJob or 0.0), 900 904 } 901 905 dn = "%s=%s,%s" % (self.info["printerrdn"], printername, self.info["printerbase"]) 902 906 self.doAdd(dn, fields) 903 return self.getPrinter(printername) 907 printer.isDirty = False 908 return None # the entry created doesn't need further modification 904 909 905 910 def addUser(self, user) : … … 1094 1099 fields = { 1095 1100 "pykotaPassThrough" : (printer.PassThrough and "t") or "f", 1096 "pykotaMaxJobSize" : (printer.MaxJobSize and str(printer.MaxJobSize)) or "0",1101 "pykotaMaxJobSize" : str(printer.MaxJobSize or 0), 1097 1102 "description" : self.userCharsetToDatabase(printer.Description or ""), 1098 "pykotaPricePerPage" : str(printer.PricePerPage ),1099 "pykotaPricePerJob" : str(printer.PricePerJob ),1103 "pykotaPricePerPage" : str(printer.PricePerPage or 0.0), 1104 "pykotaPricePerJob" : str(printer.PricePerJob or 0.0), 1100 1105 } 1101 1106 self.doModify(printer.ident, fields)