Changeset 1582 for pykota/trunk/pykota/storages/ldapstorage.py
- Timestamp:
- 07/01/04 19:45:49 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/ldapstorage.py
r1534 r1582 22 22 # 23 23 # $Log$ 24 # Revision 1.71 2004/07/01 17:45:49 jalet 25 # Added code to handle the description field for printers 26 # 24 27 # Revision 1.70 2004/06/10 20:50:25 jalet 25 28 # Better log message … … 535 538 """Extracts printer information given its name : returns first matching printer.""" 536 539 printer = StoragePrinter(self, printername) 537 result = self.doSearch("(&(objectClass=pykotaPrinter)(|(pykotaPrinterName=%s)(%s=%s)))" % (printername, self.info["printerrdn"], printername), ["pykotaPrinterName", "pykotaPricePerPage", "pykotaPricePerJob", "uniqueMember" ], base=self.info["printerbase"])540 result = self.doSearch("(&(objectClass=pykotaPrinter)(|(pykotaPrinterName=%s)(%s=%s)))" % (printername, self.info["printerrdn"], printername), ["pykotaPrinterName", "pykotaPricePerPage", "pykotaPricePerJob", "uniqueMember", "description"], base=self.info["printerbase"]) 538 541 if result : 539 542 fields = result[0][1] # take only first matching printer, ignore the rest … … 543 546 printer.PricePerPage = float(fields.get("pykotaPricePerPage", [0.0])[0] or 0.0) 544 547 printer.uniqueMember = fields.get("uniqueMember", []) 548 printer.Description = fields.get("description", [""])[0] 545 549 printer.Exists = 1 546 550 return printer … … 700 704 printers = [] 701 705 # see comment at the same place in pgstorage.py 702 result = self.doSearch("(&(objectClass=pykotaPrinter)(|%s))" % "".join(["(pykotaPrinterName=%s)(%s=%s)" % (pname, self.info["printerrdn"], pname) for pname in printerpattern.split(",")]), ["pykotaPrinterName", "pykotaPricePerPage", "pykotaPricePerJob", "uniqueMember" ], base=self.info["printerbase"])706 result = self.doSearch("(&(objectClass=pykotaPrinter)(|%s))" % "".join(["(pykotaPrinterName=%s)(%s=%s)" % (pname, self.info["printerrdn"], pname) for pname in printerpattern.split(",")]), ["pykotaPrinterName", "pykotaPricePerPage", "pykotaPricePerJob", "uniqueMember", "description"], base=self.info["printerbase"]) 703 707 if result : 704 708 for (printerid, fields) in result : … … 709 713 printer.PricePerPage = float(fields.get("pykotaPricePerPage", [0.0])[0] or 0.0) 710 714 printer.uniqueMember = fields.get("uniqueMember", []) 715 printer.Description = fields.get("description", [""])[0] 711 716 printer.Exists = 1 712 717 printers.append(printer) … … 895 900 "pykotaPricePerPage" : str(printer.PricePerPage), 896 901 "pykotaPricePerJob" : str(printer.PricePerJob), 902 } 903 self.doModify(printer.ident, fields) 904 905 def writePrinterDescription(self, printer) : 906 """Write the printer's description back into the storage.""" 907 fields = { 908 "description" : str(printer.Description), 897 909 } 898 910 self.doModify(printer.ident, fields)