- Timestamp:
- 09/18/05 00:08:28 (19 years ago)
- Location:
- pykota/trunk/pykota
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storage.py
r2455 r2459 150 150 self.Description = None 151 151 self.MaxJobSize = None 152 self.PassThrough = None 152 153 self.Coefficients = None 153 154 -
pykota/trunk/pykota/storages/ldapstorage.py
r2456 r2459 415 415 """Extracts printer information given its name : returns first matching printer.""" 416 416 printer = StoragePrinter(self, printername) 417 result = self.doSearch("(&(objectClass=pykotaPrinter)(|(pykotaPrinterName=%s)(%s=%s)))" % (printername, self.info["printerrdn"], printername), ["pykotaPrinterName", "pykotaPricePerPage", "pykotaPricePerJob", "uniqueMember", "description"], base=self.info["printerbase"]) 417 result = self.doSearch("(&(objectClass=pykotaPrinter)(|(pykotaPrinterName=%s)(%s=%s)))" \ 418 % (printername, self.info["printerrdn"], printername), \ 419 ["pykotaPrinterName", "pykotaPricePerPage", \ 420 "pykotaPricePerJob", "pykotaMaxJobSize", \ 421 "pykotaPassThrough", "uniqueMember", "description"], \ 422 base=self.info["printerbase"]) 418 423 if result : 419 424 fields = result[0][1] # take only first matching printer, ignore the rest … … 422 427 printer.PricePerJob = float(fields.get("pykotaPricePerJob", [0.0])[0]) 423 428 printer.PricePerPage = float(fields.get("pykotaPricePerPage", [0.0])[0]) 429 printer.MaxJobSize = int(fields.get("pykotaMaxJobSize", [0])[0]) 430 printer.PassThrough = fields.get("pykotaPassThrough", [None])[0] 431 if printer.PassThrough in (1, "1", "t", "true", "TRUE", "True") : 432 printer.PassThrough = 1 433 else : 434 printer.PassThrough = 0 424 435 printer.uniqueMember = fields.get("uniqueMember", []) 425 436 printer.Description = self.databaseToUserCharset(fields.get("description", [""])[0]) … … 638 649 printers = [] 639 650 # see comment at the same place in pgstorage.py 640 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"])651 result = self.doSearch("(&(objectClass=pykotaPrinter)(|%s))" % "".join(["(pykotaPrinterName=%s)(%s=%s)" % (pname, self.info["printerrdn"], pname) for pname in printerpattern.split(",")]), ["pykotaPrinterName", "pykotaPricePerPage", "pykotaPricePerJob", "pykotaMaxJobSize", "pykotaPassThrough", "uniqueMember", "description"], base=self.info["printerbase"]) 641 652 if result : 642 653 for (printerid, fields) in result : … … 646 657 printer.PricePerJob = float(fields.get("pykotaPricePerJob", [0.0])[0] or 0.0) 647 658 printer.PricePerPage = float(fields.get("pykotaPricePerPage", [0.0])[0] or 0.0) 659 printer.MaxJobSize = int(fields.get("pykotaMaxJobSize", [0])[0]) 660 printer.PassThrough = fields.get("pykotaPassThrough", [None])[0] 661 if printer.PassThrough in (1, "1", "t", "true", "TRUE", "True") : 662 printer.PassThrough = 1 663 else : 664 printer.PassThrough = 0 648 665 printer.uniqueMember = fields.get("uniqueMember", []) 649 666 printer.Description = self.databaseToUserCharset(fields.get("description", [""])[0]) … … 717 734 "pykotaPricePerPage" : "0.0", 718 735 "pykotaPricePerJob" : "0.0", 736 "pykotaMaxJobSize" : "0", 737 "pykotaPassThrough" : "0", 719 738 } 720 739 dn = "%s=%s,%s" % (self.info["printerrdn"], printername, self.info["printerbase"]) … … 1293 1312 entries = [p for p in [self.getPrinter(name) for name in self.getAllPrintersNames(pname)] if p.Exists] 1294 1313 if entries : 1295 result = [ ("dn", "printername", "priceperpage", "priceperjob", "description" ) ]1314 result = [ ("dn", "printername", "priceperpage", "priceperjob", "description", "maxjobsize", "passthrough") ] 1296 1315 for entry in entries : 1297 result.append((entry.ident, entry.Name, entry.PricePerPage, entry.PricePerJob, entry.Description)) 1316 if entry.PassThrough in (1, "1", "t", "true", "T", "TRUE", "True") : 1317 passthrough = "t" 1318 else : 1319 passthrough = "f" 1320 result.append((entry.ident, entry.Name, entry.PricePerPage, entry.PricePerJob, entry.Description, entry.MaxJobSize, passthrough)) 1298 1321 return result 1299 1322 -
pykota/trunk/pykota/storages/sql.py
r2455 r2459 214 214 printer.PricePerJob = fields.get("priceperjob") or 0.0 215 215 printer.PricePerPage = fields.get("priceperpage") or 0.0 216 printer.MaxJobSize = fields.get("maxjobsize") or 0 217 printer.PassThrough = fields.get("passthrough") or 0 218 if printer.PassThrough in (1, "1", "t", "true", "TRUE", "True") : 219 printer.PassThrough = 1 220 else : 221 printer.PassThrough = 0 216 222 printer.Description = self.databaseToUserCharset(fields.get("description") or "") 217 223 printer.Exists = 1 … … 352 358 printer.PricePerPage = record.get("priceperpage") or 0.0 353 359 printer.Description = self.databaseToUserCharset(record.get("description") or "") 360 printer.MaxJobSize = record.get("maxjobsize") or 0 361 printer.PassThrough = record.get("passthrough") or 0 362 if printer.PassThrough in (1, "1", "t", "true", "TRUE", "True") : 363 printer.PassThrough = 1 364 else : 365 printer.PassThrough = 0 354 366 printer.Exists = 1 355 367 printers.append(printer)