changeset 4859:6a7395207387

Groups2009: dicts and groups instead of group_manager_init and dict_manager_init are used.
author Dmitrijs Milajevs <dimazest@gmail.com>
date Sat, 18 Jul 2009 17:04:44 +0200
parents 2c31e088e849
children c030fa388cf5
files MoinMoin/_tests/wikiconfig_groups.py MoinMoin/conftest.py MoinMoin/datastruct/backends/_tests/test_composite_dicts.py MoinMoin/datastruct/backends/_tests/test_composite_groups.py MoinMoin/datastruct/backends/_tests/test_config_dicts.py MoinMoin/datastruct/backends/_tests/test_config_groups.py MoinMoin/datastruct/backends/_tests/test_lazy_config_groups.py MoinMoin/datastruct/backends/_tests/test_wiki_dicts.py MoinMoin/datastruct/backends/_tests/test_wiki_groups.py MoinMoin/userform/_tests/test_admin.py MoinMoin/web/contexts.py MoinMoin/wsgiapp.py
diffstat 12 files changed, 19 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/wikiconfig_groups.py	Sat Jul 18 16:06:41 2009 +0200
+++ b/MoinMoin/_tests/wikiconfig_groups.py	Sat Jul 18 17:04:44 2009 +0200
@@ -10,6 +10,6 @@
 from MoinMoin.datastruct import WikiGroups, WikiDicts
 
 class Config(LocalConfig):
-    group_manager_init = lambda self, request: WikiGroups(request)
-    dict_manager_init = lambda self, request: WikiDicts(request)
+    groups = lambda self, request: WikiGroups(request)
+    dicts = lambda self, request: WikiDicts(request)
 
--- a/MoinMoin/conftest.py	Sat Jul 18 16:06:41 2009 +0200
+++ b/MoinMoin/conftest.py	Sat Jul 18 17:04:44 2009 +0200
@@ -31,7 +31,7 @@
 
 from MoinMoin.support.python_compatibility import set
 from MoinMoin.web.request import TestRequest, Client
-from MoinMoin.wsgiapp import Application, init, init_group_manager
+from MoinMoin.wsgiapp import Application, init
 from MoinMoin._tests import maketestwiki, wikiconfig
 
 coverage_modules = set()
@@ -72,7 +72,7 @@
     request = TestRequest()
     request.given_config = given_config
     request = init(request)
-    init_group_manager(request)
+    request.groups = request.cfg.groups(request)
     return request
 
 
--- a/MoinMoin/datastruct/backends/_tests/test_composite_dicts.py	Sat Jul 18 16:06:41 2009 +0200
+++ b/MoinMoin/datastruct/backends/_tests/test_composite_dicts.py	Sat Jul 18 17:04:44 2009 +0200
@@ -28,7 +28,7 @@
         other_dict = {u'SomeOtherTestDict': {u'One': '1',
                                              u'Two': '2'}}
 
-        def dict_manager_init(self, request):
+        def dicts(self, request):
             return CompositeDicts(request,
                                   ConfigDicts(request, self.one_dict),
                                   ConfigDicts(request, self.other_dict))
--- a/MoinMoin/datastruct/backends/_tests/test_composite_groups.py	Sat Jul 18 16:06:41 2009 +0200
+++ b/MoinMoin/datastruct/backends/_tests/test_composite_groups.py	Sat Jul 18 17:04:44 2009 +0200
@@ -19,7 +19,7 @@
 
     class Config(wikiconfig.Config):
 
-        def group_manager_init(self, request):
+        def groups(self, request):
             groups = GroupsBackendTest.test_groups
             return CompositeGroups(request, ConfigGroups(request, groups))
 
@@ -49,7 +49,7 @@
                                  # first_backend and second_backend.
                                  u'AdminGroup': second_admin_group}
 
-        def group_manager_init(self, request):
+        def groups(self, request):
             return CompositeGroups(request,
                                    ConfigGroups(request, self.first_backend_groups),
                                    ConfigGroups(request, self.second_backend_groups))
--- a/MoinMoin/datastruct/backends/_tests/test_config_dicts.py	Sat Jul 18 16:06:41 2009 +0200
+++ b/MoinMoin/datastruct/backends/_tests/test_config_dicts.py	Sat Jul 18 17:04:44 2009 +0200
@@ -15,7 +15,7 @@
 
     class Config(wikiconfig.Config):
 
-        def dict_manager_init(self, request):
+        def dicts(self, request):
             dicts = DictsBackendTest.dicts
             return ConfigDicts(request, dicts)
 
--- a/MoinMoin/datastruct/backends/_tests/test_config_groups.py	Sat Jul 18 16:06:41 2009 +0200
+++ b/MoinMoin/datastruct/backends/_tests/test_config_groups.py	Sat Jul 18 17:04:44 2009 +0200
@@ -15,7 +15,7 @@
 
     class Config(wikiconfig.Config):
 
-        def group_manager_init(self, request):
+        def groups(self, request):
             groups = GroupsBackendTest.test_groups
             return ConfigGroups(request, groups)
 
--- a/MoinMoin/datastruct/backends/_tests/test_lazy_config_groups.py	Sat Jul 18 16:06:41 2009 +0200
+++ b/MoinMoin/datastruct/backends/_tests/test_lazy_config_groups.py	Sat Jul 18 17:04:44 2009 +0200
@@ -24,7 +24,7 @@
 
     class Config(wikiconfig.Config):
 
-        def group_manager_init(self, request):
+        def groups(self, request):
             groups = TestLazyConfigGroups.test_groups
             return ConfigLazyGroups(request, groups)
 
@@ -40,7 +40,7 @@
 
     class Config(wikiconfig.Config):
 
-        def group_manager_init(self, request):
+        def groups(self, request):
             config_groups = {u'EditorGroup': [u'AdminGroup', u'John', u'JoeDoe', u'Editor1', u'John'],
                              u'RecursiveGroup': [u'Something', u'OtherRecursiveGroup'],
                              u'OtherRecursiveGroup': [u'RecursiveGroup', u'Anything', u'NotExistingGroup'],
--- a/MoinMoin/datastruct/backends/_tests/test_wiki_dicts.py	Sat Jul 18 16:06:41 2009 +0200
+++ b/MoinMoin/datastruct/backends/_tests/test_wiki_dicts.py	Sat Jul 18 17:04:44 2009 +0200
@@ -16,8 +16,8 @@
 
 class TestWikiDictsBackend(DictsBackendTest):
 
-    # Suppose that default configuration for the dict_manager_init is
-    # used which is WikiDicts backend.
+    # Suppose that default configuration for the dicts is used which
+    # is WikiDicts backend.
 
     def setup_class(self):
         request = self.request
--- a/MoinMoin/datastruct/backends/_tests/test_wiki_groups.py	Sat Jul 18 16:06:41 2009 +0200
+++ b/MoinMoin/datastruct/backends/_tests/test_wiki_groups.py	Sat Jul 18 17:04:44 2009 +0200
@@ -22,8 +22,8 @@
 
 class TestWikiGroupBackend(GroupsBackendTest):
 
-    # Suppose that default configuration for the group_manager_init is
-    # used which is WikiGroups backend.
+    # Suppose that default configuration for the groups is used which
+    # is WikiGroups backend.
 
     def setup_class(self):
         become_trusted(self.request)
--- a/MoinMoin/userform/_tests/test_admin.py	Sat Jul 18 16:06:41 2009 +0200
+++ b/MoinMoin/userform/_tests/test_admin.py	Sat Jul 18 17:04:44 2009 +0200
@@ -17,7 +17,7 @@
 
     class Config(wikiconfig.Config):
 
-        def group_manager_init(self, request):
+        def groups(self, request):
             groups = {'OneGroup': ['TestUser, OtherUser'],
                       'OtherGroup': ['TestUser']}
             return ConfigGroups(request, groups)
--- a/MoinMoin/web/contexts.py	Sat Jul 18 16:06:41 2009 +0200
+++ b/MoinMoin/web/contexts.py	Sat Jul 18 17:04:44 2009 +0200
@@ -371,13 +371,13 @@
 
     def dicts(self):
         """ Lazy initialize the dicts on the first access """
-        dicts = self.cfg.dict_manager_init(self)
+        dicts = self.cfg.dicts(self)
         return dicts
     dicts = EnvironProxy(dicts)
 
     def groups(self):
         """ Lazy initialize the groups on the first access """
-        groups = self.cfg.group_manager_init(self)
+        groups = self.cfg.groups(self)
         return groups
     groups = EnvironProxy(groups)
 
--- a/MoinMoin/wsgiapp.py	Sat Jul 18 16:06:41 2009 +0200
+++ b/MoinMoin/wsgiapp.py	Sat Jul 18 17:04:44 2009 +0200
@@ -48,9 +48,6 @@
     context.clock.stop('init')
     return context
 
-def init_group_manager(context):
-    context.groups = context.cfg.group_manager_init(context)
-
 def run(context):
     """ Run a context trough the application. """
     context.clock.start('run')
@@ -250,7 +247,7 @@
         try:
             request = self.Request(environ)
             context = init(request)
-            init_group_manager(context)
+            context.groups = context.cfg.groups(context)
             response = run(context)
             context.clock.stop('total')
         except HTTPException, e: