changeset 4797:4539a7956eac

Groups2009: BaseBackend _exists_group, _get_group and _get_group_names methods were removed.
author Dmitrijs Milajevs <dimazest@gmail.com>
date Wed, 10 Jun 2009 10:45:41 +0200
parents 7dd5d15de911
children ed977dd981ce
files MoinMoin/groups/backends/__init__.py MoinMoin/groups/backends/wiki_group.py
diffstat 2 files changed, 9 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/groups/backends/__init__.py	Tue Jun 09 23:35:01 2009 +0200
+++ b/MoinMoin/groups/backends/__init__.py	Wed Jun 10 10:45:41 2009 +0200
@@ -112,24 +112,22 @@
         """
         Check if a group called <group_name> is available in this backend.
         """
-        return self._exists_group(group_name)
+        raise NotImplementedError()
 
     def __iter__(self):
         """
-        Iterate over group names of the groups defined in this backend.
+        Iterate over moin group names of the groups defined in this backend.
 
         @return: moin group names
         """
-        backend_group_names = self._get_group_names()
-        return (self.to_group_name(backend_group_name) for backend_group_name in backend_group_names)
+        raise NotImplementedError()
 
     def __getitem__(self, group_name):
         """
         Get a group by its moin group name.
         """
-        return self._get_group(group_name)
+        raise NotImplementedError()
 
-    # These methods should be overridden in children classes.
     def to_backend_name(self, group_name):
         """
         A function mapping the moin group name to the backend group name.
@@ -142,23 +140,3 @@
         """
         return backend_group_name
 
-    def _exists_group(self, group_name):
-        """
-        Check if the group <group_name> is defined in the backend.
-        """
-        raise NotImplementedError()
-
-    def _get_group(self, group_name):
-        """
-        Retrieve a <group_name> group members from the backend.
-
-        @return: a group with retrieved members. [Group]
-        """
-        raise NotImplementedError()
-
-    def _get_group_names(self):
-        """
-        Retrieve moin group names stored in the backend.
-        """
-        raise NotImplementedError()
-
--- a/MoinMoin/groups/backends/wiki_group.py	Tue Jun 09 23:35:01 2009 +0200
+++ b/MoinMoin/groups/backends/wiki_group.py	Wed Jun 10 10:45:41 2009 +0200
@@ -79,13 +79,14 @@
 
         self.page_group_regex = request.cfg.cache.page_group_regexact
 
-    def _exists_group(self, group_name):
+    def __contains__(self, group_name):
         backend_group_name = self.to_backend_name(group_name)
         return self.page_group_regex.match(group_name) and Page(self.request, backend_group_name).exists()
 
-    def _get_group_names(self):
-        return self.request.rootpage.getPageList(user='', filter=self.page_group_regex.search)
+    def __iter__(self):
+        backend_group_names = self.request.rootpage.getPageList(user='', filter=self.page_group_regex.search)
+        return (self.to_group_name(backend_group_name) for backend_group_name in backend_group_names)
 
-    def _get_group(self, group_name):
+    def __getitem__(self, group_name):
         return Group(request=self.request, name=group_name, backend=self)