Index: pykota/trunk/pykota/storages/pgstorage.py
===================================================================
--- pykota/trunk/pykota/storages/pgstorage.py (revision 1136)
+++ pykota/trunk/pykota/storages/pgstorage.py (revision 1137)
@@ -21,4 +21,7 @@
 #
 # $Log$
+# Revision 1.17  2003/10/06 13:12:28  jalet
+# More work on caching
+#
 # Revision 1.16  2003/10/03 18:01:49  jalet
 # Nothing interesting...
@@ -256,14 +259,5 @@
         return lastjob
             
-    def getUserGroups(self, user) :        
-        """Returns the user's groups list."""
-        groups = []
-        result = self.doSearch("SELECT groupname FROM groupsmembers JOIN groups ON groupsmembers.groupid=groups.id WHERE userid=%s" % self.doQuote(user.ident))
-        if result :
-            for record in result :
-                groups.append(self.getGroup(record.get("groupname")))
-        return groups        
-        
-    def getGroupMembers(self, group) :        
+    def getGroupMembersFromBackend(self, group) :        
         """Returns the group's members list."""
         groupmembers = []
@@ -281,4 +275,13 @@
                 self.cacheEntry("USERS", user.Name, user)
         return groupmembers        
+        
+    def getUserGroupsFromBackend(self, user) :        
+        """Returns the user's groups list."""
+        groups = []
+        result = self.doSearch("SELECT groupname FROM groupsmembers JOIN groups ON groupsmembers.groupid=groups.id WHERE userid=%s" % self.doQuote(user.ident))
+        if result :
+            for record in result :
+                groups.append(self.getGroup(record.get("groupname")))
+        return groups        
         
     def getMatchingPrinters(self, printerpattern) :
Index: pykota/trunk/pykota/storages/ldapstorage.py
===================================================================
--- pykota/trunk/pykota/storages/ldapstorage.py (revision 1133)
+++ pykota/trunk/pykota/storages/ldapstorage.py (revision 1137)
@@ -21,4 +21,7 @@
 #
 # $Log$
+# Revision 1.29  2003/10/06 13:12:28  jalet
+# More work on caching
+#
 # Revision 1.28  2003/10/03 12:27:02  jalet
 # Several optimizations, especially with LDAP backend
@@ -266,6 +269,5 @@
             group.AccountBalance = 0.0
             group.LifeTimePaid = 0.0
-            group.Members = self.getGroupMembers(group)
-            for member in group.Members :
+            for member in self.getGroupMembers(group) :
                 if member.Exists :
                     group.AccountBalance += member.AccountBalance
@@ -346,6 +348,4 @@
                 grouppquota.PageCounter = 0
                 grouppquota.LifePageCounter = 0
-                if (not hasattr(group, "Members")) or (group.Members is None) :
-                    group.Members = self.getGroupMembers(group)
                 usernamesfilter = "".join(["(pykotaUserName=%s)" % member.Name for member in group.Members])
                 result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaPrinterName=%s)(|%s))" % (printer.Name, usernamesfilter), ["pykotaPageCounter", "pykotaLifePageCounter"], base=self.info["userquotabase"])
@@ -384,5 +384,14 @@
         return lastjob
         
-    def getUserGroups(self, user) :        
+    def getGroupMembersFromBackend(self, group) :        
+        """Returns the group's members list."""
+        groupmembers = []
+        result = self.doSearch("(&(objectClass=pykotaGroup)(|(pykotaGroupName=%s)(%s=%s)))" % (group.Name, self.info["grouprdn"], group.Name), [self.info["groupmembers"]], base=self.info["groupbase"])
+        if result :
+            for username in result[0][1].get(self.info["groupmembers"], []) :
+                groupmembers.append(self.getUser(username))
+        return groupmembers        
+        
+    def getUserGroupsFromBackend(self, user) :        
         """Returns the user's groups list."""
         groups = []
@@ -392,13 +401,4 @@
                 groups.append(self.getGroup(fields.get(self.info["grouprdn"])[0]))
         return groups        
-        
-    def getGroupMembers(self, group) :        
-        """Returns the group's members list."""
-        groupmembers = []
-        result = self.doSearch("(&(objectClass=pykotaGroup)(|(pykotaGroupName=%s)(%s=%s)))" % (group.Name, self.info["grouprdn"], group.Name), [self.info["groupmembers"]], base=self.info["groupbase"])
-        if result :
-            for username in result[0][1].get(self.info["groupmembers"], []) :
-                groupmembers.append(self.getUser(username))
-        return groupmembers        
         
     def getMatchingPrinters(self, printerpattern) :
