Index: pykota/trunk/pykota/storages/ldapstorage.py
===================================================================
--- pykota/trunk/pykota/storages/ldapstorage.py (revision 1995)
+++ pykota/trunk/pykota/storages/ldapstorage.py (revision 1998)
@@ -22,4 +22,8 @@
 #
 # $Log$
+# Revision 1.93  2004/12/31 16:10:57  jalet
+# Fixed recently introduced bugs due to extended userquotabase and groupquotabase
+# directives.
+#
 # Revision 1.92  2004/12/26 14:50:51  jalet
 # Normalized fields names in dumpykota's output so that an LDAP or PostgreSQL
@@ -702,7 +706,8 @@
         if printer.Exists and user.Exists :
             if self.info["userquotabase"].lower() == "user" :
-                result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaUserName=%s)(pykotaPrinterName=%s))" % (user.Name, printer.Name), ["pykotaPageCounter", "pykotaLifePageCounter", "pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=user.ident)
+                base = user.ident
             else :    
-                result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaUserName=%s)(pykotaPrinterName=%s))" % (user.Name, printer.Name), ["pykotaPageCounter", "pykotaLifePageCounter", "pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=self.info["userquotabase"])
+                base = self.info["userquotabase"]
+            result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaUserName=%s)(pykotaPrinterName=%s))" % (user.Name, printer.Name), ["pykotaPageCounter", "pykotaLifePageCounter", "pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=base)
             if result :
                 fields = result[0][1]
@@ -736,7 +741,8 @@
         if group.Exists :
             if self.info["groupquotabase"].lower() == "group" :
-                result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaGroupName=%s)(pykotaPrinterName=%s))" % (group.Name, printer.Name), ["pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=group.ident)
+                base = group.ident
             else :    
-                result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaGroupName=%s)(pykotaPrinterName=%s))" % (group.Name, printer.Name), ["pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=self.info["groupquotabase"])
+                base = self.info["groupquotabase"]
+            result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaGroupName=%s)(pykotaPrinterName=%s))" % (group.Name, printer.Name), ["pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=base)
             if result :
                 fields = result[0][1]
@@ -765,5 +771,9 @@
                 if usernamesfilter :
                     usernamesfilter = "(|%s)" % usernamesfilter
-                result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaPrinterName=%s)%s)" % (printer.Name, usernamesfilter), ["pykotaPageCounter", "pykotaLifePageCounter"], base=self.info["userquotabase"])
+                if self.info["userquotabase"].lower() == "user" :
+                    base = self.info["userbase"]
+                else :
+                    base = self.info["userquotabase"]
+                result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaPrinterName=%s)%s)" % (printer.Name, usernamesfilter), ["pykotaPageCounter", "pykotaLifePageCounter"], base=base)
                 if result :
                     for userpquota in result :    
@@ -885,5 +895,9 @@
         """Returns the list of users who uses a given printer, along with their quotas."""
         usersandquotas = []
-        result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaPrinterName=%s)(|%s))" % (printer.Name, "".join(["(pykotaUserName=%s)" % uname for uname in names])), ["pykotaUserName", "pykotaPageCounter", "pykotaLifePageCounter", "pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=self.info["userquotabase"])
+        if self.info["userquotabase"].lower() == "user" :
+           base = self.info["userbase"]
+        else :
+           base = self.info["userquotabase"]
+        result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaPrinterName=%s)(|%s))" % (printer.Name, "".join(["(pykotaUserName=%s)" % uname for uname in names])), ["pykotaUserName", "pykotaPageCounter", "pykotaLifePageCounter", "pykotaSoftLimit", "pykotaHardLimit", "pykotaDateLimit"], base=base)
         if result :
             for (userquotaid, fields) in result :
@@ -920,5 +934,9 @@
         """Returns the list of groups which uses a given printer, along with their quotas."""
         groupsandquotas = []
-        result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaPrinterName=%s)(|%s))" % (printer.Name, "".join(["(pykotaGroupName=%s)" % gname for gname in names])), ["pykotaGroupName"], base=self.info["groupquotabase"])
+        if self.info["groupquotabase"].lower() == "group" :
+           base = self.info["groupbase"]
+        else :
+           base = self.info["groupquotabase"]
+        result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaPrinterName=%s)(|%s))" % (printer.Name, "".join(["(pykotaGroupName=%s)" % gname for gname in names])), ["pykotaGroupName"], base=base)
         if result :
             for (groupquotaid, fields) in result :
@@ -1328,6 +1346,9 @@
         for (ident, fields) in result :
             todelete.append(ident)
-            
-        result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaUserName=%s))" % user.Name, ["pykotaPrinterName", "pykotaUserName"], base=self.info["userquotabase"])
+        if self.info["userquotabase"].lower() == "user" :
+            base = self.info["userbase"]
+        else :
+            base = self.info["userquotabase"]
+        result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaUserName=%s))" % user.Name, ["pykotaPrinterName", "pykotaUserName"], base=base)
         for (ident, fields) in result :
             # ensure the user print quota entry will be deleted
@@ -1369,5 +1390,9 @@
     def deleteGroup(self, group) :    
         """Completely deletes a group from the Quota Storage."""
-        result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaGroupName=%s))" % group.Name, ["pykotaGroupName"], base=self.info["groupquotabase"])
+        if self.info["groupquotabase"].lower() == "group" :
+            base = self.info["groupbase"]
+        else :
+            base = self.info["groupquotabase"]
+        result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaGroupName=%s))" % group.Name, ["pykotaGroupName"], base=base)
         for (ident, fields) in result :
             self.doDelete(ident)
@@ -1400,8 +1425,16 @@
         for (ident, fields) in result :
             self.doDelete(ident)
-        result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaPrinterName=%s))" % printer.Name, base=self.info["groupquotabase"])
+        if self.info["groupquotabase"].lower() == "group" :
+            base = self.info["groupbase"]
+        else :
+            base = self.info["groupquotabase"]
+        result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaPrinterName=%s))" % printer.Name, base=base)
         for (ident, fields) in result :
             self.doDelete(ident)
-        result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaPrinterName=%s))" % printer.Name, base=self.info["userquotabase"])
+        if self.info["userquotabase"].lower() == "user" :
+            base = self.info["userbase"]
+        else :
+            base = self.info["userquotabase"]
+        result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaPrinterName=%s))" % printer.Name, base=base)
         for (ident, fields) in result :
             self.doDelete(ident)
Index: pykota/trunk/pykota/version.py
===================================================================
--- pykota/trunk/pykota/version.py (revision 1993)
+++ pykota/trunk/pykota/version.py (revision 1998)
@@ -22,5 +22,5 @@
 #
 
-__version__ = "1.21alpha15_unofficial"
+__version__ = "1.21alpha16_unofficial"
 
 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""
