changeset 4168:2edbd96f3179

Replaced request.getScriptname() with a werkzeug property
author Florian Krupicka <florian.krupicka@googlemail.com>
date Mon, 16 Jun 2008 12:11:24 +0200
parents e89b74d3a031
children 1d5995a6a0e2
files MoinMoin/Page.py MoinMoin/PageEditor.py MoinMoin/PageGraphicalEditor.py MoinMoin/action/AttachFile.py MoinMoin/action/Despam.py MoinMoin/action/PackagePages.py MoinMoin/action/SpellCheck.py MoinMoin/action/SubscribeUser.py MoinMoin/action/__init__.py MoinMoin/action/backup.py MoinMoin/action/fckdialog.py MoinMoin/converter/text_html_text_moin_wiki.py MoinMoin/macro/AdvancedSearch.py MoinMoin/macro/FullSearch.py MoinMoin/macro/NewPage.py MoinMoin/macro/__init__.py MoinMoin/request/__init__.py MoinMoin/session.py MoinMoin/support/parsedatetime/parsedatetime_consts.py MoinMoin/theme/__init__.py MoinMoin/userform/login.py MoinMoin/userprefs/oid.py MoinMoin/web/contexts.py MoinMoin/widget/browser.py MoinMoin/wikiutil.py
diffstat 25 files changed, 42 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/Page.py	Mon Jun 16 12:11:24 2008 +0200
@@ -759,7 +759,7 @@
             url = "%s#%s" % (url, wikiutil.url_quote_plus(anchor))
 
         if not relative:
-            url = '%s/%s' % (request.getScriptname(), url)
+            url = '%s/%s' % (request.script_root, url)
         return url
 
     def link_to_raw(self, request, text, querystr=None, anchor=None, **kw):
@@ -1028,7 +1028,7 @@
             # 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(),
+                request.script_root,
                 wikiutil.quoteWikinameURL(pi['redirect']),
                 wikiutil.url_quote_plus(self.page_name, ''), ))
             return
--- a/MoinMoin/PageEditor.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/PageEditor.py	Mon Jun 16 12:11:24 2008 +0200
@@ -332,7 +332,7 @@
 
         # send form
         request.write('<form id="editor" method="post" action="%s/%s#preview" onSubmit="flgChange = false;">' % (
-            request.getScriptname(),
+            request.script_root,
             wikiutil.quoteWikinameURL(self.page_name),
             ))
 
--- a/MoinMoin/PageGraphicalEditor.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/PageGraphicalEditor.py	Mon Jun 16 12:11:24 2008 +0200
@@ -223,7 +223,7 @@
 
         # send form
         request.write('<form id="editor" method="post" action="%s/%s#preview">' % (
-            request.getScriptname(),
+            request.script_root,
             wikiutil.quoteWikinameURL(self.page_name),
             ))
 
@@ -313,7 +313,7 @@
         url_prefix_local = request.cfg.url_prefix_local
         wikipage = wikiutil.quoteWikinameURL(self.page_name)
         fckbasepath = url_prefix_local + '/applets/FCKeditor'
-        wikiurl = request.getScriptname()
+        wikiurl = request.script_root
         if not wikiurl or wikiurl[-1] != '/':
             wikiurl += '/'
         themepath = '%s/%s' % (url_prefix_static, request.theme.name)
--- a/MoinMoin/action/AttachFile.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/action/AttachFile.py	Mon Jun 16 12:11:24 2008 +0200
@@ -83,7 +83,7 @@
         qs = '?%s' % wikiutil.makeQueryString(kw, want_unicode=False)
     else:
         qs = ''
-    return "%s/%s%s" % (request.getScriptname(), wikiutil.quoteWikinameURL(pagename), qs)
+    return "%s/%s%s" % (request.script_root, wikiutil.quoteWikinameURL(pagename), qs)
 
 
 def getAttachUrl(pagename, filename, request, addts=0, escaped=0, do='get', drawing='', upload=False):
@@ -489,7 +489,7 @@
 </p>
 </form>
 """ % {
-    'baseurl': request.getScriptname(),
+    'baseurl': request.script_root,
     'pagename': wikiutil.quoteWikinameURL(pagename),
     'action_name': action_name,
     'upload_label_file': _('File to upload'),
@@ -755,7 +755,7 @@
 
     # move file
     d = {'action': action_name,
-         'baseurl': request.getScriptname(),
+         'baseurl': request.script_root,
          'do': 'attachment_move',
          'ticket': wikiutil.createTicket(request),
          'pagename': pagename,
--- a/MoinMoin/action/Despam.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/action/Despam.py	Mon Jun 16 12:11:24 2008 +0200
@@ -110,7 +110,7 @@
 <input type="submit" name="ok" value="%s">
 </form>
 </p>
-''' % (request.getScriptname(), wikiutil.quoteWikinameURL(pagename),
+''' % (request.script_root, wikiutil.quoteWikinameURL(pagename),
        wikiutil.url_quote(editor), _("Revert all!")))
 
 def revert_page(request, pagename, editor):
--- a/MoinMoin/action/PackagePages.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/action/PackagePages.py	Mon Jun 16 12:11:24 2008 +0200
@@ -114,7 +114,7 @@
             error = u'<p class="error">%s</p>\n' % error
 
         d = {
-            'baseurl': self.request.getScriptname(),
+            'baseurl': self.request.script_root,
             'error': error,
             'action': self.__class__.__name__,
             'pagename': wikiutil.escape(self.pagename, True),
--- a/MoinMoin/action/SpellCheck.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/action/SpellCheck.py	Mon Jun 16 12:11:24 2008 +0200
@@ -188,7 +188,7 @@
         # add a form containing the bad words
         if own_form:
             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)
+                         '<input type="hidden" name="action" value="%s">\n') % (request.script_root, 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	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/action/SubscribeUser.py	Mon Jun 16 12:11:24 2008 +0200
@@ -25,7 +25,7 @@
 %s <input type="text" name="users" size="50">
 <input type="submit" value="Subscribe">
 </form>
-""" % (request.getScriptname(), wikiutil.quoteWikinameURL(pagename),
+""" % (request.script_root, wikiutil.quoteWikinameURL(pagename),
       _("Enter user names (comma separated):")))
     request.theme.send_footer(pagename)
     request.theme.send_closing_html()
--- a/MoinMoin/action/__init__.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/action/__init__.py	Mon Jun 16 12:11:24 2008 +0200
@@ -136,7 +136,7 @@
 
         d = {
             'method': self.method,
-            'baseurl': self.request.getScriptname(),
+            'baseurl': self.request.script_root,
             'enctype': self.enctype,
             'error_html': error_html,
             'actionname': self.actionname,
--- a/MoinMoin/action/backup.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/action/backup.py	Mon Jun 16 12:11:24 2008 +0200
@@ -104,7 +104,7 @@
 <input type="submit" value="%(restore_button)s">
 </form>
 """ % {
-    'baseurl': request.getScriptname(),
+    'baseurl': request.script_root,
     'pagename': wikiutil.quoteWikinameURL(pagename),
     'backup_button': _('Backup'),
     'restore_button': _('Restore'),
--- a/MoinMoin/action/fckdialog.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/action/fckdialog.py	Mon Jun 16 12:11:24 2008 +0200
@@ -242,7 +242,7 @@
 
     # wiki url
     url_prefix_static = request.cfg.url_prefix_static
-    scriptname = request.getScriptname()
+    scriptname = request.script_root
     if not scriptname or scriptname[-1] != "/":
         scriptname += "/"
     action = scriptname
@@ -393,7 +393,7 @@
 
     # wiki url
     url_prefix_static = request.cfg.url_prefix_static
-    scriptname = request.getScriptname()
+    scriptname = request.script_root
     if not scriptname or scriptname[-1] != "/":
         scriptname += "/"
     action = scriptname
--- a/MoinMoin/converter/text_html_text_moin_wiki.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/converter/text_html_text_moin_wiki.py	Mon Jun 16 12:11:24 2008 +0200
@@ -1120,7 +1120,7 @@
         href = attrs.pop('href', None)
         css_class = attrs.get('class')
 
-        scriptname = self.request.getScriptname()
+        scriptname = self.request.script_root
         if scriptname == "":
             scriptname = "/"
 
--- a/MoinMoin/macro/AdvancedSearch.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/macro/AdvancedSearch.py	Mon Jun 16 12:11:24 2008 +0200
@@ -161,7 +161,7 @@
 
     # the dialogue
     return f.rawHTML('\n'.join([
-        u'<form method="get" action="%s/%s">' % (macro.request.getScriptname(), wikiutil.quoteWikinameURL(macro.request.formatter.page.page_name)),
+        u'<form method="get" action="%s/%s">' % (macro.request.script_root, 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	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/macro/FullSearch.py	Mon Jun 16 12:11:24 2008 +0200
@@ -67,7 +67,7 @@
     # Format
     type = (type == "titlesearch")
     html = [
-        u'<form method="get" action="%s/%s">' % (macro.request.getScriptname(), wikiutil.quoteWikinameURL(macro.request.formatter.page.page_name)),
+        u'<form method="get" action="%s/%s">' % (macro.request.script_root, 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	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/macro/NewPage.py	Mon Jun 16 12:11:24 2008 +0200
@@ -76,7 +76,7 @@
 
         # TODO: better abstract this using the formatter
         html = [
-            u'<form class="macro" method="POST" action="%s/%s"><div>' % (self.request.getScriptname(), wikiutil.quoteWikinameURL(self.formatter.page.page_name)),
+            u'<form class="macro" method="POST" action="%s/%s"><div>' % (self.request.script_root, 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(self.parent, 1),
             u'<input type="hidden" name="template" value="%s">' % wikiutil.escape(self.template, 1),
--- a/MoinMoin/macro/__init__.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/macro/__init__.py	Mon Jun 16 12:11:24 2008 +0200
@@ -280,7 +280,7 @@
         """
         _ = self._
         html = [
-            u'<form method="get" action="%s/%s"><div>' % (self.request.getScriptname(), wikiutil.quoteWikinameURL(self.formatter.page.page_name)),
+            u'<form method="get" action="%s/%s"><div>' % (self.request.script_root, 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/request/__init__.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/request/__init__.py	Mon Jun 16 12:11:24 2008 +0200
@@ -1015,7 +1015,7 @@
 
     def getBaseURL(self):
         """ Return a fully qualified URL to this script. """
-        return self.getQualifiedURL(self.getScriptname())
+        return self.getQualifiedURL(self.script_root)
 
     def getQualifiedURL(self, uri=''):
         """ Return an absolute URL starting with schema and host.
--- a/MoinMoin/session.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/session.py	Mon Jun 16 12:11:24 2008 +0200
@@ -314,7 +314,7 @@
         if cfg.cookie_path:
             cookie[cookie_name]['path'] = cfg.cookie_path
         else:
-            path = request.getScriptname()
+            path = request.script_root
             if not path:
                 path = '/'
             cookie[cookie_name]['path'] = path
--- a/MoinMoin/support/parsedatetime/parsedatetime_consts.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/support/parsedatetime/parsedatetime_consts.py	Mon Jun 16 12:11:24 2008 +0200
@@ -574,4 +574,4 @@
 
         return sources
 
-        
\ No newline at end of file
+        
--- a/MoinMoin/theme/__init__.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/theme/__init__.py	Mon Jun 16 12:11:24 2008 +0200
@@ -743,7 +743,7 @@
             'search_value': wikiutil.escape(form.get('value', [''])[0], 1),
             'search_full_label': _('Text'),
             'search_title_label': _('Titles'),
-            'baseurl': self.request.getScriptname(),
+            'baseurl': self.request.script_root,
             'pagename_quoted': wikiutil.quoteWikinameURL(d['page'].page_name),
             }
         d.update(updates)
@@ -1035,7 +1035,7 @@
             'options': '\n'.join(options),
             'rev_field': rev and '<input type="hidden" name="rev" value="%d">' % rev or '',
             'do_button': _("Do"),
-            'baseurl': self.request.getScriptname(),
+            'baseurl': self.request.script_root,
             'pagename_quoted': wikiutil.quoteWikinameURL(page.page_name),
             }
         html = '''
@@ -1538,7 +1538,7 @@
             page = Page(request, pagename)
         if keywords.get('msg', ''):
             raise DeprecationWarning("Using send_page(msg=) is deprecated! Use theme.add_msg() instead!")
-        scriptname = request.getScriptname()
+        scriptname = request.script_root
         pagename_quoted = wikiutil.quoteWikinameURL(pagename)
 
         # get name of system pages
@@ -1632,12 +1632,12 @@
             #~         # this shopuld never happend in theory, but let's be sure
             #~         pass
             #~     else:
-            #~         request.write('<link rel="First" href="%s/%s">\n' % (request.getScriptname(), quoteWikinameURL(all_pages[0]))
+            #~         request.write('<link rel="First" href="%s/%s">\n' % (request.script_root, quoteWikinameURL(all_pages[0]))
             #~         if pos > 0:
-            #~             request.write('<link rel="Previous" href="%s/%s">\n' % (request.getScriptname(), quoteWikinameURL(all_pages[pos-1])))
+            #~             request.write('<link rel="Previous" href="%s/%s">\n' % (request.script_root, quoteWikinameURL(all_pages[pos-1])))
             #~         if pos+1 < len(all_pages):
-            #~             request.write('<link rel="Next" href="%s/%s">\n' % (request.getScriptname(), quoteWikinameURL(all_pages[pos+1])))
-            #~         request.write('<link rel="Last" href="%s/%s">\n' % (request.getScriptname(), quoteWikinameURL(all_pages[-1])))
+            #~             request.write('<link rel="Next" href="%s/%s">\n' % (request.script_root, quoteWikinameURL(all_pages[pos+1])))
+            #~         request.write('<link rel="Last" href="%s/%s">\n' % (request.script_root, quoteWikinameURL(all_pages[-1])))
 
             if page_parent_page:
                 output.append('<link rel="Up" href="%s/%s">\n' % (scriptname, wikiutil.quoteWikinameURL(page_parent_page)))
--- a/MoinMoin/userform/login.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/userform/login.py	Mon Jun 16 12:11:24 2008 +0200
@@ -33,7 +33,7 @@
         """ Create the complete HTML form code. """
         _ = self._
         request = self.request
-        sn = request.getScriptname()
+        sn = request.script_root
         pi = request.getPathinfo()
         action = u"%s%s" % (sn, pi)
         hints = []
--- a/MoinMoin/userprefs/oid.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/userprefs/oid.py	Mon Jun 16 12:11:24 2008 +0200
@@ -150,7 +150,7 @@
         return
 
     def _make_form(self):
-        sn = self.request.getScriptname()
+        sn = self.request.script_root
         pi = self.request.getPathinfo()
         action = u"%s%s" % (sn, pi)
         _form = html.FORM(action=action)
--- a/MoinMoin/web/contexts.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/web/contexts.py	Mon Jun 16 12:11:24 2008 +0200
@@ -80,7 +80,7 @@
 class XMLRPCContext(Context):
     pass
 
-class HTTPContext(Context, RequestBase):
+class HTTPContext(Context): #, RequestBase):
     """ Lowermost context for MoinMoin.
 
     Contains code related to manipulation of HTTP related data like:
--- a/MoinMoin/widget/browser.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/widget/browser.py	Mon Jun 16 12:11:24 2008 +0200
@@ -97,7 +97,7 @@
         fmt = self.request.formatter
 
         result = []
-        result.append(fmt.rawHTML('<form action="%s/%s" method="GET" name="%sform">' % (self.request.getScriptname(), wikiutil.quoteWikinameURL(self.request.page.page_name), self.data_id)))
+        result.append(fmt.rawHTML('<form action="%s/%s" method="GET" name="%sform">' % (self.request.script_root, wikiutil.quoteWikinameURL(self.request.page.page_name), self.data_id)))
         result.append(fmt.div(1))
 
         havefilters = False
--- a/MoinMoin/wikiutil.py	Sun Jun 15 22:38:29 2008 +0200
+++ b/MoinMoin/wikiutil.py	Mon Jun 16 12:11:24 2008 +0200
@@ -563,7 +563,7 @@
             if not line or line[0] == '#':
                 continue
             try:
-                line = "%s %s/InterWiki" % (line, request.getScriptname())
+                line = "%s %s/InterWiki" % (line, request.script_root)
                 wikitag, urlprefix, dummy = line.split(None, 2)
             except ValueError:
                 pass
@@ -573,9 +573,9 @@
         del lines
 
         # add own wiki as "Self" and by its configured name
-        _interwiki_list['Self'] = request.getScriptname() + '/'
+        _interwiki_list['Self'] = request.script_root + '/'
         if request.cfg.interwikiname:
-            _interwiki_list[request.cfg.interwikiname] = request.getScriptname() + '/'
+            _interwiki_list[request.cfg.interwikiname] = request.script_root + '/'
 
         # save for later
         request.cfg.cache.interwiki_list = _interwiki_list
@@ -647,7 +647,7 @@
     if wikiname in _interwiki_list:
         return (wikiname, _interwiki_list[wikiname], pagename, False)
     else:
-        return (wikiname, request.getScriptname(), "/InterWiki", True)
+        return (wikiname, request.script_root, "/InterWiki", True)
 
 def resolve_interwiki(request, wikiname, pagename):
     """ Resolve an interwiki reference (wikiname:pagename).
@@ -662,7 +662,7 @@
     if wikiname in _interwiki_list:
         return (wikiname, _interwiki_list[wikiname], pagename, False)
     else:
-        return (wikiname, request.getScriptname(), "/InterWiki", True)
+        return (wikiname, request.script_root, "/InterWiki", True)
 
 def join_wiki(wikiurl, wikitail):
     """
@@ -2380,7 +2380,7 @@
     if text is None:
         text = params # default
     if formatter:
-        url = "%s/%s" % (request.getScriptname(), params)
+        url = "%s/%s" % (request.script_root, params)
         # formatter.url will escape the url part
         if on is not None:
             tag = formatter.url(on, url, css_class, **kw)
@@ -2399,7 +2399,7 @@
                 attrs += ' id="%s"' % id
             if name:
                 attrs += ' name="%s"' % name
-            tag = '<a%s href="%s/%s">' % (attrs, request.getScriptname(), params)
+            tag = '<a%s href="%s/%s">' % (attrs, request.script_root, params)
             if not on:
                 tag = "%s%s</a>" % (tag, text)
         logging.warning("wikiutil.link_tag called without formatter and without request.html_formatter. tag=%r" % (tag, ))