changeset 615:fb4240ec8361

make goto an action (1 special case less)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 05 May 2006 10:40:13 +0200
parents 95fb435b72aa
children 3b08d9413589 8cfff674409f
files MoinMoin/request.py MoinMoin/wikiaction.py MoinMoin/wikimacro.py
diffstat 3 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/request.py	Fri May 05 09:39:41 2006 +0200
+++ b/MoinMoin/request.py	Fri May 05 10:40:13 2006 +0200
@@ -1077,12 +1077,7 @@
                 execute(pagename, self)
                 raise MoinMoinNoFooter           
 
-            # 4. Or redirect to another page
-            elif self.form.has_key('goto'):
-                self.http_redirect(Page(self, self.form['goto'][0]).url(self))
-                return self.finish()
-
-            # 5. Or handle action
+            # 4. Or handle action
             else:
                 if action is None:
                     action = 'show'
--- a/MoinMoin/wikiaction.py	Fri May 05 09:39:41 2006 +0200
+++ b/MoinMoin/wikiaction.py	Fri May 05 10:40:13 2006 +0200
@@ -29,6 +29,13 @@
 ### Misc Actions
 #############################################################################
 
+def do_goto(pagename, request):
+    """ redirect to another page """
+    target = request.form.get('target', [''])[0]
+    request.http_redirect(Page(request, target).url(request))
+    request.finish()
+    raise MoinMoinNoFooter
+
 def do_diff(pagename, request):
     """ Handle "action=diff"
         checking for either a "rev=formerrevision" parameter
--- a/MoinMoin/wikimacro.py	Fri May 05 09:39:41 2006 +0200
+++ b/MoinMoin/wikimacro.py	Fri May 05 10:40:13 2006 +0200
@@ -205,7 +205,8 @@
         html = [
             u'<form method="get" action="">',
             u'<div>',
-            u'<input type="text" name="goto" size="30">',
+            u'<input type="hidden" name="action" value="goto">',
+            u'<input type="text" name="target" size="30">',
             u'<input type="submit" value="%s">' % _("Go To Page"),
             u'</div>',
             u'</form>',