- Timestamp:
- 03/05/04 14:19:53 (21 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/ldapstorage.py
r1380 r1392 22 22 # 23 23 # $Log$ 24 # Revision 1.61 2004/03/05 13:19:53 jalet 25 # Code safer wrt entries created in other tools 26 # 24 27 # Revision 1.60 2004/03/02 14:39:02 jalet 25 28 # Final fix for printers searching … … 495 498 fields = result[0][1] 496 499 printer.ident = result[0][0] 497 printer.PricePerJob = float(fields.get("pykotaPricePerJob" )[0] or 0.0)498 printer.PricePerPage = float(fields.get("pykotaPricePerPage" )[0] or 0.0)500 printer.PricePerJob = float(fields.get("pykotaPricePerJob", [0.0])[0] or 0.0) 501 printer.PricePerPage = float(fields.get("pykotaPricePerPage", [0.0])[0] or 0.0) 499 502 printer.uniqueMember = fields.get("uniqueMember", []) 500 503 printer.Exists = 1 … … 509 512 fields = result[0][1] 510 513 userpquota.ident = result[0][0] 511 userpquota.PageCounter = int(fields.get("pykotaPageCounter" )[0] or 0)512 userpquota.LifePageCounter = int(fields.get("pykotaLifePageCounter" )[0] or 0)514 userpquota.PageCounter = int(fields.get("pykotaPageCounter", [0])[0] or 0) 515 userpquota.LifePageCounter = int(fields.get("pykotaLifePageCounter", [0])[0] or 0) 513 516 userpquota.SoftLimit = fields.get("pykotaSoftLimit") 514 517 if userpquota.SoftLimit is not None : … … 566 569 if result : 567 570 for userpquota in result : 568 grouppquota.PageCounter += int(userpquota[1].get("pykotaPageCounter" )[0] or 0)569 grouppquota.LifePageCounter += int(userpquota[1].get("pykotaLifePageCounter" )[0] or 0)571 grouppquota.PageCounter += int(userpquota[1].get("pykotaPageCounter", [0])[0] or 0) 572 grouppquota.LifePageCounter += int(userpquota[1].get("pykotaLifePageCounter", [0])[0] or 0) 570 573 grouppquota.Exists = 1 571 574 return grouppquota … … 584 587 lastjob.JobId = fields.get("pykotaJobId")[0] 585 588 lastjob.UserName = fields.get("pykotaUserName")[0] 586 lastjob.PrinterPageCounter = int(fields.get("pykotaPrinterPageCounter" )[0] or 0)589 lastjob.PrinterPageCounter = int(fields.get("pykotaPrinterPageCounter", [0])[0] or 0) 587 590 lastjob.JobSize = int(fields.get("pykotaJobSize", [0])[0]) 588 591 lastjob.JobPrice = float(fields.get("pykotaJobPrice", [0.0])[0]) … … 592 595 lastjob.JobCopies = int(fields.get("pykotaCopies", [0])[0]) 593 596 lastjob.JobOptions = fields.get("pykotaOptions", [""])[0] 594 date = fields.get("createTimestamp" )[0]597 date = fields.get("createTimestamp", ["19700101000000"])[0] 595 598 year = int(date[:4]) 596 599 month = int(date[4:6]) … … 659 662 printer = StoragePrinter(self, printername) 660 663 printer.ident = printerid 661 printer.PricePerJob = float(fields.get("pykotaPricePerJob" )[0] or 0.0)662 printer.PricePerPage = float(fields.get("pykotaPricePerPage" )[0] or 0.0)664 printer.PricePerJob = float(fields.get("pykotaPricePerJob", [0.0])[0] or 0.0) 665 printer.PricePerPage = float(fields.get("pykotaPricePerPage", [0.0])[0] or 0.0) 663 666 printer.uniqueMember = fields.get("uniqueMember", []) 664 667 printer.Exists = 1 … … 676 679 userpquota = StorageUserPQuota(self, user, printer) 677 680 userpquota.ident = userquotaid 678 userpquota.PageCounter = int(fields.get("pykotaPageCounter" )[0] or 0)679 userpquota.LifePageCounter = int(fields.get("pykotaLifePageCounter" )[0] or 0)681 userpquota.PageCounter = int(fields.get("pykotaPageCounter", [0])[0] or 0) 682 userpquota.LifePageCounter = int(fields.get("pykotaLifePageCounter", [0])[0] or 0) 680 683 userpquota.SoftLimit = fields.get("pykotaSoftLimit") 681 684 if userpquota.SoftLimit is not None : … … 1003 1006 job.ident = ident 1004 1007 job.JobId = fields.get("pykotaJobId")[0] 1005 job.PrinterPageCounter = int(fields.get("pykotaPrinterPageCounter" )[0] or 0)1008 job.PrinterPageCounter = int(fields.get("pykotaPrinterPageCounter", [0])[0] or 0) 1006 1009 job.JobSize = int(fields.get("pykotaJobSize", [0])[0]) 1007 1010 job.JobPrice = float(fields.get("pykotaJobPrice", [0.0])[0]) 1008 job.JobAction = fields.get("pykotaAction" )[0]1011 job.JobAction = fields.get("pykotaAction", [""])[0] 1009 1012 job.JobFileName = fields.get("pykotaFileName", [""])[0] 1010 1013 job.JobTitle = fields.get("pykotaTitle", [""])[0] 1011 1014 job.JobCopies = int(fields.get("pykotaCopies", [0])[0]) 1012 1015 job.JobOptions = fields.get("pykotaOptions", [""])[0] 1013 date = fields.get("createTimestamp" )[0]1016 date = fields.get("createTimestamp", ["19700101000000"])[0] 1014 1017 year = int(date[:4]) 1015 1018 month = int(date[4:6])