changeset 2296:f22518801de4

allow wizard-like userprefs (and document how to achieve that)
author Johannes Berg <johannes AT sipsolutions DOT net>
date Tue, 10 Jul 2007 18:43:00 +0200
parents 66cc37b8f297
children 84aad7171a56
files MoinMoin/action/userprefs.py MoinMoin/userprefs/__init__.py
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/userprefs.py	Tue Jul 10 17:20:29 2007 +0200
+++ b/MoinMoin/action/userprefs.py	Tue Jul 10 18:43:00 2007 +0200
@@ -55,16 +55,18 @@
     pagename = request.page.page_name
 
     if 'handler' in request.form:
-        return _create_prefs_page(request), None, _handle_submission(request)
+        msg = _handle_submission(request)
+    else:
+        msg = None
 
     sub = request.form.get('sub', [''])[0]
     try:
         cls = wikiutil.importPlugin(request.cfg, 'userprefs', sub, 'Settings')
     except wikiutil.PluginMissingError:
-        return _create_prefs_page(request), None, None
+        return _create_prefs_page(request), None, msg
 
     obj = cls(request)
-    return obj.create_form(), obj.title, None
+    return obj.create_form(), obj.title, msg
 
 
 def execute(pagename, request):
--- a/MoinMoin/userprefs/__init__.py	Tue Jul 10 17:20:29 2007 +0200
+++ b/MoinMoin/userprefs/__init__.py	Tue Jul 10 18:43:00 2007 +0200
@@ -39,6 +39,9 @@
             hidden fields
               * action: set to "userprefs"
               * handler: set to the plugin name
+            It can additionally contain the hidden field
+            'sub' set to the plugin name if the plugin needs
+            multiple forms (wizard-like.)
         '''
         raise NotImplementedError