changeset 2066:9cf6a6b474c5

rename create_simple_mapping() acl param names, you may need to update your wikiconfig! It is now called like this: create_simple_mapping(uri='...', default_acl=..., userprofiles_acl=...) This was "content_acl" and "user_profile_acl" before, but as the namespaces are named "default" and "userprofiles", I changed it for better consistency.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 31 Mar 2013 23:09:55 +0200
parents 1b78d0d4b13d
children 091125cedd6c
files MoinMoin/_tests/test_test_environ.py MoinMoin/_tests/wikiconfig.py MoinMoin/conftest.py MoinMoin/security/_tests/test_security.py MoinMoin/storage/__init__.py docs/admin/configure.rst wikiconfig.py
diffstat 7 files changed, 24 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_test_environ.py	Sun Mar 31 23:00:14 2013 +0200
+++ b/MoinMoin/_tests/test_test_environ.py	Sun Mar 31 23:09:55 2013 +0200
@@ -34,7 +34,7 @@
         assert storage.has_item(itemname)
 
 
-CONTENT_ACL = dict(
+DEFAULT_ACL = dict(
     before="+All:write",  # need to write to sys pages
     default="All:read,write,admin,create,destroy",
     after="Me:create",
@@ -45,8 +45,8 @@
 class TestStorageEnvironWithConfig(object):
 
     class Config(wikiconfig.Config):
-        content_acl = CONTENT_ACL
+        default_acl = DEFAULT_ACL
 
     def test_config(self):
         assert isinstance(app.cfg, wikiconfig.Config)
-        assert app.cfg.content_acl == CONTENT_ACL
+        assert app.cfg.default_acl == DEFAULT_ACL
--- a/MoinMoin/_tests/wikiconfig.py	Sun Mar 31 23:00:14 2013 +0200
+++ b/MoinMoin/_tests/wikiconfig.py	Sun Mar 31 23:09:55 2013 +0200
@@ -26,7 +26,7 @@
     _root = abspath(join(_here, '..', '..'))
     data_dir = join(_here, 'wiki', 'data')  # needed for plugins package TODO
     index_storage = 'FileStorage', (join(_here, 'wiki', 'index'), ), {}
-    content_acl = None
+    default_acl = None
     item_root = 'FrontPage'
     interwikiname = u'MoinTest'
     interwiki_map = dict(Self='http://localhost:8080/', MoinMoin='http://moinmo.in/')
--- a/MoinMoin/conftest.py	Sun Mar 31 23:00:14 2013 +0200
+++ b/MoinMoin/conftest.py	Sun Mar 31 23:09:55 2013 +0200
@@ -45,7 +45,7 @@
 
 def init_test_app(given_config):
     namespace_mapping, backend_mapping, acl_mapping = \
-        create_simple_mapping("stores:memory:", given_config.content_acl)
+        create_simple_mapping("stores:memory:", given_config.default_acl)
     more_config = dict(
         namespace_mapping=namespace_mapping,
         backend_mapping=backend_mapping,
--- a/MoinMoin/security/_tests/test_security.py	Sun Mar 31 23:00:14 2013 +0200
+++ b/MoinMoin/security/_tests/test_security.py	Sun Mar 31 23:09:55 2013 +0200
@@ -336,7 +336,7 @@
     from MoinMoin._tests import wikiconfig
 
     class Config(wikiconfig.Config):
-        content_acl = dict(hierarchic=False, before=u"WikiAdmin:admin,read,write,create,destroy", default=u"All:read,write", after=u"All:read")
+        default_acl = dict(hierarchic=False, before=u"WikiAdmin:admin,read,write,create,destroy", default=u"All:read,write", after=u"All:read")
         acl_functions = u"SuperUser:superuser NoTextchaUser:notextcha"
 
     def setup_method(self, method):
@@ -423,7 +423,7 @@
     from MoinMoin._tests import wikiconfig
 
     class Config(wikiconfig.Config):
-        content_acl = dict(hierarchic=True, before=u"WikiAdmin:admin,read,write,create,destroy", default=u"All:read,write", after=u"All:read")
+        default_acl = dict(hierarchic=True, before=u"WikiAdmin:admin,read,write,create,destroy", default=u"All:read,write", after=u"All:read")
 
     def setup_method(self, method):
         become_trusted(username=u'WikiAdmin')
@@ -497,7 +497,7 @@
     from MoinMoin._tests import wikiconfig
 
     class Config(wikiconfig.Config):
-        content_acl = dict(hierarchic=True, before=u"WikiAdmin:admin,read,write,create,destroy", default=u"Editor:read,write", after=u"All:read")
+        default_acl = dict(hierarchic=True, before=u"WikiAdmin:admin,read,write,create,destroy", default=u"Editor:read,write", after=u"All:read")
 
     def setup_method(self, method):
         become_trusted(username=u'WikiAdmin')
--- a/MoinMoin/storage/__init__.py	Sun Mar 31 23:00:14 2013 +0200
+++ b/MoinMoin/storage/__init__.py	Sun Mar 31 23:09:55 2013 +0200
@@ -54,7 +54,7 @@
 
 
 def create_simple_mapping(uri='stores:fs:instance',
-                          content_acl=None, user_profile_acl=None):
+                          default_acl=None, userprofiles_acl=None):
     """
     When configuring storage, the admin needs to provide a namespace_mapping.
     To ease creation of such a mapping, this function provides sane defaults
@@ -79,10 +79,10 @@
                  to below /path/to/store/.
     """
     # if no acls are given, use something mostly harmless:
-    if not content_acl:
-        content_acl = dict(before=u'', default=u'All:read,write,create', after=u'', hierarchic=False)
-    if not user_profile_acl:
-        user_profile_acl = dict(before=u'All:', default=u'', after=u'', hierarchic=False)
+    if not default_acl:
+        default_acl = dict(before=u'', default=u'All:read,write,create', after=u'', hierarchic=False)
+    if not userprofiles_acl:
+        userprofiles_acl = dict(before=u'All:', default=u'', after=u'', hierarchic=False)
     namespaces = {
         NAMESPACE_DEFAULT: BACKEND_DEFAULT,
         NAMESPACE_USERPROFILES + ':': BACKEND_USERPROFILES,
@@ -92,7 +92,7 @@
         BACKEND_USERPROFILES: None,
     }
     acls = {
-        NAMESPACE_USERPROFILES + ':': user_profile_acl,
-        NAMESPACE_DEFAULT: content_acl,
+        NAMESPACE_USERPROFILES + ':': userprofiles_acl,
+        NAMESPACE_DEFAULT: default_acl,
     }
     return create_mapping(uri, namespaces, backends, acls)
--- a/docs/admin/configure.rst	Sun Mar 31 23:00:14 2013 +0200
+++ b/docs/admin/configure.rst	Sun Mar 31 23:09:55 2013 +0200
@@ -1042,13 +1042,14 @@
 
     namespace_mapping, backend_mapping, acl_mapping = create_simple_mapping(
         uri=...,
-        content_acl=dict(before=...,
+        default_acl=dict(before=...,
                          default=...,
                          after=...,
                          hierarchic=..., ),
-        user_profile_acl=dict(before=...,
+        userprofiles_acl=dict(before=...,
                               default=...,
-                              after=..., ),
+                              after=...,
+                              hierarchiv=False, ),
     )
 
 The `uri` depends on the kind of storage backend and stores you want to use, 
@@ -1074,7 +1075,7 @@
 | userprofiles   | /srv/mywiki/userprofiles/   |
 +----------------+-----------------------------+
 
-`content_acl` and `user_profile_acl` are dictionaries specifying the ACLs for
+`default_acl` and `userprofiles_acl` are dictionaries specifying the ACLs for
 this part of the namespace (normal content, user profiles).
 See the docs about ACLs.
 
@@ -1122,10 +1123,10 @@
     data_dir = '/srv/mywiki/data'
     namespace_mapping, acl_mapping = create_simple_mapping(
         uri='stores:fs:{0}/%(nsname)s/%(kind)s'.format(data_dir),
-        content_acl=dict(before=u'WikiAdmin:read,write,create,destroy',
+        default_acl=dict(before=u'WikiAdmin:read,write,create,destroy',
                          default=u'All:read,write,create',
                          after=u'', ),
-        user_profile_acl=dict(before=u'WikiAdmin:read,write,create,destroy',
+        userprofiles_acl=dict(before=u'WikiAdmin:read,write,create,destroy',
                               default=u'',
                               after=u'', ),
     )
--- a/wikiconfig.py	Sun Mar 31 23:00:14 2013 +0200
+++ b/wikiconfig.py	Sun Mar 31 23:09:55 2013 +0200
@@ -34,11 +34,11 @@
     namespace_mapping, backend_mapping, acl_mapping = create_simple_mapping(
         uri='stores:fs:{0}/%(backend)s/%(kind)s'.format(data_dir),
         # XXX we use rather relaxed ACLs for the development wiki:
-        content_acl=dict(before=u'',
+        default_acl=dict(before=u'',
                          default=u'All:read,write,create,destroy,admin',
                          after=u'',
                          hierarchic=False, ),
-        user_profile_acl=dict(before=u'',
+        userprofiles_acl=dict(before=u'',
                               default=u'All:read,write,create,destroy,admin',
                               after=u'',
                               hierarchic=False, ),