changeset 4794:d9151c006aab

Groups2009: wiki_page backend Group refinements. A _load_group() handles group loading from cache or a wiki page. KeyError in the _load_group() returns a name of not existing group. An _iter() does not add already stored group name to the processed_groups.
author Dmitrijs Milajevs <dimazest@gmail.com>
date Tue, 09 Jun 2009 16:01:26 +0200
parents cab105f9fd55
children 64ff4ea0b597
files MoinMoin/groups/backends/wiki_group.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/groups/backends/wiki_group.py	Mon Jun 08 19:49:39 2009 +0200
+++ b/MoinMoin/groups/backends/wiki_group.py	Tue Jun 09 16:01:26 2009 +0200
@@ -41,6 +41,11 @@
         """
         self.request = request
         self.group_name = group_name
+        self._load_group()
+
+    def _load_group(self):
+        request = self.request
+        group_name = self.group_name
 
         page = Page(request, group_name)
         if page.exists():
@@ -62,8 +67,7 @@
                 self.members, self.member_groups = self._parse_page(text)
                 cache.update((self.members, self. member_groups))
         else:
-            # we have no such group
-            raise KeyError
+            raise KeyError("There is no such group page %s" % group_name)
 
     def _parse_page(self, text):
         """
@@ -136,7 +140,6 @@
         for group_name in self.member_groups:
             if group_name not in processed_groups:
                 for member in groups[group_name]._iter(yielded_members, processed_groups):
-                    processed_groups.add(group_name)
                     if member not in yielded_members:
                         yield member
                         yielded_members.add(member)