Index: pykota/trunk/pykota/storages/ldapstorage.py
===================================================================
--- pykota/trunk/pykota/storages/ldapstorage.py (revision 1380)
+++ pykota/trunk/pykota/storages/ldapstorage.py (revision 1392)
@@ -22,4 +22,7 @@
 #
 # $Log$
+# Revision 1.61  2004/03/05 13:19:53  jalet
+# Code safer wrt entries created in other tools
+#
 # Revision 1.60  2004/03/02 14:39:02  jalet
 # Final fix for printers searching
@@ -495,6 +498,6 @@
             fields = result[0][1]
             printer.ident = result[0][0]
-            printer.PricePerJob = float(fields.get("pykotaPricePerJob")[0] or 0.0)
-            printer.PricePerPage = float(fields.get("pykotaPricePerPage")[0] or 0.0)
+            printer.PricePerJob = float(fields.get("pykotaPricePerJob", [0.0])[0] or 0.0)
+            printer.PricePerPage = float(fields.get("pykotaPricePerPage", [0.0])[0] or 0.0)
             printer.uniqueMember = fields.get("uniqueMember", [])
             printer.Exists = 1
@@ -509,6 +512,6 @@
                 fields = result[0][1]
                 userpquota.ident = result[0][0]
-                userpquota.PageCounter = int(fields.get("pykotaPageCounter")[0] or 0)
-                userpquota.LifePageCounter = int(fields.get("pykotaLifePageCounter")[0] or 0)
+                userpquota.PageCounter = int(fields.get("pykotaPageCounter", [0])[0] or 0)
+                userpquota.LifePageCounter = int(fields.get("pykotaLifePageCounter", [0])[0] or 0)
                 userpquota.SoftLimit = fields.get("pykotaSoftLimit")
                 if userpquota.SoftLimit is not None :
@@ -566,6 +569,6 @@
                 if result :
                     for userpquota in result :    
-                        grouppquota.PageCounter += int(userpquota[1].get("pykotaPageCounter")[0] or 0)
-                        grouppquota.LifePageCounter += int(userpquota[1].get("pykotaLifePageCounter")[0] or 0)
+                        grouppquota.PageCounter += int(userpquota[1].get("pykotaPageCounter", [0])[0] or 0)
+                        grouppquota.LifePageCounter += int(userpquota[1].get("pykotaLifePageCounter", [0])[0] or 0)
                 grouppquota.Exists = 1
         return grouppquota
@@ -584,5 +587,5 @@
                 lastjob.JobId = fields.get("pykotaJobId")[0]
                 lastjob.UserName = fields.get("pykotaUserName")[0]
-                lastjob.PrinterPageCounter = int(fields.get("pykotaPrinterPageCounter")[0] or 0)
+                lastjob.PrinterPageCounter = int(fields.get("pykotaPrinterPageCounter", [0])[0] or 0)
                 lastjob.JobSize = int(fields.get("pykotaJobSize", [0])[0])
                 lastjob.JobPrice = float(fields.get("pykotaJobPrice", [0.0])[0])
@@ -592,5 +595,5 @@
                 lastjob.JobCopies = int(fields.get("pykotaCopies", [0])[0])
                 lastjob.JobOptions = fields.get("pykotaOptions", [""])[0]
-                date = fields.get("createTimestamp")[0]
+                date = fields.get("createTimestamp", ["19700101000000"])[0]
                 year = int(date[:4])
                 month = int(date[4:6])
@@ -659,6 +662,6 @@
                 printer = StoragePrinter(self, printername)
                 printer.ident = printerid
-                printer.PricePerJob = float(fields.get("pykotaPricePerJob")[0] or 0.0)
-                printer.PricePerPage = float(fields.get("pykotaPricePerPage")[0] or 0.0)
+                printer.PricePerJob = float(fields.get("pykotaPricePerJob", [0.0])[0] or 0.0)
+                printer.PricePerPage = float(fields.get("pykotaPricePerPage", [0.0])[0] or 0.0)
                 printer.uniqueMember = fields.get("uniqueMember", [])
                 printer.Exists = 1
@@ -676,6 +679,6 @@
                 userpquota = StorageUserPQuota(self, user, printer)
                 userpquota.ident = userquotaid
-                userpquota.PageCounter = int(fields.get("pykotaPageCounter")[0] or 0)
-                userpquota.LifePageCounter = int(fields.get("pykotaLifePageCounter")[0] or 0)
+                userpquota.PageCounter = int(fields.get("pykotaPageCounter", [0])[0] or 0)
+                userpquota.LifePageCounter = int(fields.get("pykotaLifePageCounter", [0])[0] or 0)
                 userpquota.SoftLimit = fields.get("pykotaSoftLimit")
                 if userpquota.SoftLimit is not None :
@@ -1003,13 +1006,13 @@
                 job.ident = ident
                 job.JobId = fields.get("pykotaJobId")[0]
-                job.PrinterPageCounter = int(fields.get("pykotaPrinterPageCounter")[0] or 0)
+                job.PrinterPageCounter = int(fields.get("pykotaPrinterPageCounter", [0])[0] or 0)
                 job.JobSize = int(fields.get("pykotaJobSize", [0])[0])
                 job.JobPrice = float(fields.get("pykotaJobPrice", [0.0])[0])
-                job.JobAction = fields.get("pykotaAction")[0]
+                job.JobAction = fields.get("pykotaAction", [""])[0]
                 job.JobFileName = fields.get("pykotaFileName", [""])[0]
                 job.JobTitle = fields.get("pykotaTitle", [""])[0]
                 job.JobCopies = int(fields.get("pykotaCopies", [0])[0])
                 job.JobOptions = fields.get("pykotaOptions", [""])[0]
-                date = fields.get("createTimestamp")[0]
+                date = fields.get("createTimestamp", ["19700101000000"])[0]
                 year = int(date[:4])
                 month = int(date[4:6])
