changeset 3040:8608b258f8e6

bug fix of MoinMoinBugs/MoveAttachmentNotWorkingWithModPython (thanks to Boleslaw Kulbabinski) (ported from 1.6)
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Tue, 05 Feb 2008 21:22:56 +0100
parents 744c46c1f869
children 7400c1f2e20a
files MoinMoin/action/AttachFile.py MoinMoin/action/PackagePages.py MoinMoin/action/SpellCheck.py MoinMoin/action/SubscribeUser.py MoinMoin/action/__init__.py MoinMoin/macro/AdvancedSearch.py MoinMoin/macro/FullSearch.py MoinMoin/macro/NewPage.py MoinMoin/macro/__init__.py MoinMoin/theme/__init__.py MoinMoin/widget/browser.py
diffstat 11 files changed, 28 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Mon Feb 04 10:17:58 2008 +0100
+++ b/MoinMoin/action/AttachFile.py	Tue Feb 05 21:22:56 2008 +0100
@@ -826,9 +826,11 @@
 
     # move file
     d = {'action': 'AttachFile',
+         'baseurl': request.getScriptname(),
          'do': 'attachment_move',
          'ticket': wikiutil.createTicket(request),
          'pagename': pagename,
+         'pagename_quoted': wikiutil.quoteWikinameURL(pagename),
          'attachment_name': filename,
          'move': _('Move'),
          'cancel': _('Cancel'),
@@ -836,7 +838,7 @@
          'attachment_label': _("New attachment name"),
         }
     formhtml = '''
-<form method="post" action="">
+<form action="%(baseurl)s/%(pagename_quoted)s" method="POST">
 <input type="hidden" name="action" value="%(action)s">
 <input type="hidden" name="do" value="%(do)s">
 <input type="hidden" name="ticket" value="%(ticket)s">
--- a/MoinMoin/action/PackagePages.py	Mon Feb 04 10:17:58 2008 +0100
+++ b/MoinMoin/action/PackagePages.py	Tue Feb 05 21:22:56 2008 +0100
@@ -144,9 +144,11 @@
         error = u'<p class="error">%s</p>\n' % error
 
         d = {
+            'baseurl': self.request.getScriptname(),
             'error': error,
             'action': self.__class__.__name__,
             'pagename': wikiutil.escape(self.pagename),
+            'pagename_quoted': wikiutil.quoteWikinameURL(self.pagename),
             'package': _('Package pages'),
             'cancel': _('Cancel'),
             'newname_label': _("Package name"),
@@ -154,7 +156,7 @@
         }
         form = '''
 %(error)s
-<form method="post" action="">
+<form method="post" action="%(baseurl)s/%(pagename_quoted)s">
 <input type="hidden" name="action" value="%(action)s">
 <table>
     <tr>
--- a/MoinMoin/action/SpellCheck.py	Mon Feb 04 10:17:58 2008 +0100
+++ b/MoinMoin/action/SpellCheck.py	Tue Feb 05 21:22:56 2008 +0100
@@ -187,8 +187,8 @@
 
         # add a form containing the bad words
         if own_form:
-            msg = msg + ('<form method="post" action="">\n'
-                         '<input type="hidden" name="action" value="%s">\n') % action_name
+            msg = msg + ('<form method="post" action="%s/%s">\n'
+                         '<input type="hidden" name="action" value="%s">\n') % (request.getScriptname(), wikiutil.quoteWikinameURL(page.page_name), action_name)
 
         checkbox = '<input type="checkbox" name="newwords" value="%(word)s">%(word)s&nbsp;&nbsp;'
         msg = msg + (
--- a/MoinMoin/action/SubscribeUser.py	Mon Feb 04 10:17:58 2008 +0100
+++ b/MoinMoin/action/SubscribeUser.py	Tue Feb 05 21:22:56 2008 +0100
@@ -12,6 +12,7 @@
 
 from MoinMoin.Page import Page
 from MoinMoin import user
+from MoinMoin import wikiutil
 
 def show_form(pagename, request):
     _ = request.getText
@@ -19,12 +20,13 @@
     request.theme.send_title(_("Subscribe users to the page %s") % pagename, pagename=pagename)
 
     request.write("""
-<form action="" method="POST" enctype="multipart/form-data">
+<form action="%s/%s" method="POST" enctype="multipart/form-data">
 <input type="hidden" name="action" value="SubscribeUser">
-Enter user names (comma separated): <input type="text" name="users" size="50">
+%s <input type="text" name="users" size="50">
 <input type="submit" value="Subscribe">
 </form>
-""")
+""" % (request.getScriptname(), wikiutil.quoteWikinameURL(pagename),
+      _("Enter user names (comma separated):", formatted=False)))
     request.theme.send_footer(pagename)
     request.theme.send_closing_html()
 
--- a/MoinMoin/action/__init__.py	Mon Feb 04 10:17:58 2008 +0100
+++ b/MoinMoin/action/__init__.py	Tue Feb 05 21:22:56 2008 +0100
@@ -130,17 +130,19 @@
 
         d = {
             'method': self.method,
+            'baseurl': self.request.getScriptname(),
             'enctype': self.enctype,
             'error_html': error_html,
             'actionname': self.actionname,
             'pagename': self.pagename,
+            'pagename_quoted': wikiutil.quoteWikinameURL(self.pagename),
             'ticket_html': ticket_html,
             'user_html': self.get_form_html(buttons_html),
         }
 
         form_html = '''
 %(error_html)s
-<form action="" method="%(method)s" enctype="%(enctype)s">
+<form action="%(baseurl)s/%(pagename_quoted)s" method="%(method)s" enctype="%(enctype)s">
 <div>
 <input type="hidden" name="action" value="%(actionname)s">
 %(ticket_html)s
--- a/MoinMoin/macro/AdvancedSearch.py	Mon Feb 04 10:17:58 2008 +0100
+++ b/MoinMoin/macro/AdvancedSearch.py	Tue Feb 05 21:22:56 2008 +0100
@@ -8,11 +8,11 @@
     @license: GNU GPL, see COPYING for details.
 """
 
+from MoinMoin import wikiutil
 from MoinMoin.i18n import languages
 from MoinMoin.widget import html
 from MoinMoin.util.web import makeSelection
 from MoinMoin.support.python_compatibility import sorted
-
 import mimetypes
 
 Dependencies = ['pages']
@@ -135,7 +135,7 @@
 
     # the dialogue
     return f.rawHTML('\n'.join([
-        u'<form method="get" action="">',
+        u'<form method="get" action="%s/%s">' % (macro.request.getScriptname(), wikiutil.quoteWikinameURL(macro.request.formatter.page.page_name)),
         u'<div>',
         u'<input type="hidden" name="action" value="fullsearch">',
         u'<input type="hidden" name="advancedsearch" value="1">',
--- a/MoinMoin/macro/FullSearch.py	Mon Feb 04 10:17:58 2008 +0100
+++ b/MoinMoin/macro/FullSearch.py	Tue Feb 05 21:22:56 2008 +0100
@@ -67,7 +67,7 @@
     # Format
     type = (type == "titlesearch")
     html = [
-        u'<form method="get" action="">',
+        u'<form method="get" action="%s/%s">' % (macro.request.getScriptname(), wikiutil.quoteWikinameURL(macro.request.formatter.page.page_name)),
         u'<div>',
         u'<input type="hidden" name="action" value="fullsearch">',
         u'<input type="hidden" name="titlesearch" value="%i">' % type,
--- a/MoinMoin/macro/NewPage.py	Mon Feb 04 10:17:58 2008 +0100
+++ b/MoinMoin/macro/NewPage.py	Tue Feb 05 21:22:56 2008 +0100
@@ -92,7 +92,7 @@
 
         # TODO: better abstract this using the formatter
         html = [
-            u'<form class="macro" method="get" action=""><div>',
+            u'<form class="macro" method="get" action="%s/%s"><div>' % (self.request.getScriptname(), wikiutil.quoteWikinameURL(self.formatter.page.page_name)),
             u'<input type="hidden" name="action" value="newpage">',
             u'<input type="hidden" name="parent" value="%s">' % wikiutil.escape(parent, 1),
             u'<input type="hidden" name="template" value="%s">' % wikiutil.escape(template, 1),
--- a/MoinMoin/macro/__init__.py	Mon Feb 04 10:17:58 2008 +0100
+++ b/MoinMoin/macro/__init__.py	Tue Feb 05 21:22:56 2008 +0100
@@ -299,7 +299,7 @@
         """
         _ = self._
         html = [
-            u'<form method="get" action="">',
+            u'<form method="get" action="%s/%s"><div>' % (self.request.getScriptname(), wikiutil.quoteWikinameURL(self.formatter.page.page_name)),
             u'<div>',
             u'<input type="hidden" name="action" value="goto">',
             u'<input type="text" name="target" size="30">',
--- a/MoinMoin/theme/__init__.py	Mon Feb 04 10:17:58 2008 +0100
+++ b/MoinMoin/theme/__init__.py	Tue Feb 05 21:22:56 2008 +0100
@@ -736,11 +736,13 @@
             'search_value': wikiutil.escape(form.get('value', [''])[0], 1),
             'search_full_label': _('Text', formatted=False),
             'search_title_label': _('Titles', formatted=False),
+            'baseurl': self.request.getScriptname(),
+            'pagename_quoted': wikiutil.quoteWikinameURL(self.request.page.page_name),
             }
         d.update(updates)
 
         html = u'''
-<form id="searchform" method="get" action="">
+<form id="searchform" method="get" action="%(baseurl)s/%(pagename_quoted)s">
 <div>
 <input type="hidden" name="action" value="fullsearch">
 <input type="hidden" name="context" value="180">
@@ -999,7 +1001,9 @@
             'label': titles['__title__'],
             'options': '\n'.join(options),
             'rev_field': rev and '<input type="hidden" name="rev" value="%d">' % rev or '',
-            'do_button': _("Do")
+            'do_button': _("Do", formatted=False),
+            'baseurl': self.request.getScriptname(),
+            'pagename_quoted': wikiutil.quoteWikinameURL(self.request.page.page_name)
             }
         html = '''
 <form class="actionsmenu" method="get" action="">
--- a/MoinMoin/widget/browser.py	Mon Feb 04 10:17:58 2008 +0100
+++ b/MoinMoin/widget/browser.py	Tue Feb 05 21:22:56 2008 +0100
@@ -85,7 +85,7 @@
         fmt = self.request.formatter
 
         result = []
-        result.append(fmt.rawHTML('<form action="" method="GET">'))
+        result.append(fmt.rawHTML('<form action="%s/%s" method="GET">' % (self.request.getScriptname(), wikiutil.quoteWikinameURL(self.request.page.page_name))))
         result.append(fmt.div(1))
 
         havefilters = False