changeset 4770:193277fe231f

Groups 2009: group name mapping functions refinement.
author Dmitrijs Milajevs <dimazest@gmail.com>
date Wed, 27 May 2009 09:26:59 +0200
parents 55c40ed9dac1
children d85a2b2f120b
files MoinMoin/groups/__init__.py
diffstat 1 files changed, 3 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/groups/__init__.py	Tue May 26 16:48:54 2009 +0200
+++ b/MoinMoin/groups/__init__.py	Wed May 27 09:26:59 2009 +0200
@@ -16,7 +16,7 @@
     group name. It provides access to groups of specific backend.
     """
 
-    def __init__(self, backend, mapper_to_backend=None, mapper_from_backend=None):
+    def __init__(self, backend, mapper_to_backend=lambda x: x, mapper_from_backend=lambda x: x):
         """
         Creates backend manager object.
 
@@ -37,20 +37,8 @@
         name to the moin group name
         """
         self._backend = backend
-
-        # XXX Should we check that *two* mapper functions are passed,
-        # and if not throw an exception?
-        if mapper_to_backend is not None:
-            self.mapper_to_backend = mapper_to_backend
-        else:
-            # Nothing to map, just return unmodified string
-            self.mapper_to_backend = lambda x: x
-
-        if mapper_from_backend is not None:
-            self.mapper_from_backend = mapper_from_backend
-        else:
-            # Nothing to map, just return unmodified string
-            self.mapper_from_backend = lambda x: x
+        self.mapper_to_backend = mapper_to_backend
+        self.mapper_from_backend =  mapper_from_backend
 
     def __getitem__(self, group_name):
         """