changeset 4806:dcbdf7e5660d

Groups2009: to_backend_name and to_group_name methods were removed. If a backend needs group name mapping it must handle it internally.
author Dmitrijs Milajevs <dimazest@gmail.com>
date Sat, 13 Jun 2009 20:14:27 +0200
parents 6a109416e2b2
children ca8fcf330aa8
files MoinMoin/groups/backends/__init__.py MoinMoin/groups/backends/config_group.py
diffstat 2 files changed, 4 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/groups/backends/__init__.py	Thu Jun 11 14:08:13 2009 +0200
+++ b/MoinMoin/groups/backends/__init__.py	Sat Jun 13 20:14:27 2009 +0200
@@ -24,9 +24,6 @@
         self.members = None
         self.member_groups = None
 
-        self.to_backend_name = backend.to_backend_name
-        self.to_group_name = backend.to_group_name
-
         self._load_group()
 
     def _load_group(self):
@@ -129,18 +126,6 @@
         """
         raise NotImplementedError()
 
-    def to_backend_name(self, group_name):
-        """
-        A function mapping the moin group name to the backend group name.
-        """
-        return group_name
-
-    def to_group_name(self, backend_group_name):
-        """
-        A function mapping the backend group name to the moin group name.
-        """
-        return backend_group_name
-
     def __repr__(self):
         return "<%s groups=%s>" % (self.__class__, [b for b in self])
 
--- a/MoinMoin/groups/backends/config_group.py	Thu Jun 11 14:08:13 2009 +0200
+++ b/MoinMoin/groups/backends/config_group.py	Sat Jun 13 20:14:27 2009 +0200
@@ -15,14 +15,13 @@
 
     def _load_group(self):
         request = self.request
-        backend_group_name = self.to_backend_name(self.name)
 
         members_final = set()
         member_groups = set()
 
-        for member in self._backend._groups[backend_group_name]:
+        for member in self._backend._groups[self.name]:
             if member in self._backend._groups:
-                member_groups.add(self.to_group_name(member))
+                member_groups.add(member)
             else:
                 members_final.add(member)
 
@@ -42,12 +41,10 @@
         self._groups = groups
 
     def __contains__(self, group_name):
-        backend_group_name = self.to_backend_name(group_name)
-        return self.page_group_regex.match(group_name) and backend_group_name in self._groups
+        return self.page_group_regex.match(group_name) and group_name in self._groups
 
     def __iter__(self):
-        backend_group_names = self._groups.keys()
-        return (self.to_group_name(backend_group_name) for backend_group_name in backend_group_names)
+        return iter(self._groups.keys())
 
     def __getitem__(self, group_name):
         return Group(request=self.request, name=group_name, backend=self)