changeset 4497:6beaf3e083c6

#redirect processing instruction: fix handling of anchors, simplify code
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 22 Jan 2009 18:50:27 +0100
parents c76d50dac855
children 910474dded06 f7ee4c468401
files MoinMoin/Page.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Mon Jan 19 01:20:04 2009 +0100
+++ b/MoinMoin/Page.py	Thu Jan 22 18:50:27 2009 +0100
@@ -1026,10 +1026,11 @@
             # redirect to another page
             # note that by including "action=show", we prevent endless looping
             # (see code in "request") or any cascaded redirection
-            request.http_redirect('%s/%s?action=show&redirect=%s' % (
-                request.getScriptname(),
-                wikiutil.quoteWikinameURL(pi['redirect']),
-                wikiutil.url_quote_plus(self.page_name, ''), ))
+            pagename, anchor = wikiutil.split_anchor(pi['redirect'])
+            redirect_url = Page(request, pagename).url(request,
+                                                       querystr={'action': 'show', 'redirect': self.page_name, },
+                                                       anchor=anchor)
+            request.http_redirect(redirect_url)
             return
 
         # if necessary, load the formatter