diff MoinMoin/action/AttachFile.py @ 101:2202f548cbb0

use own urllib wrapper, see wikiutil imported from: moin--main--1.5--patch-103
author Thomas Waldmann <tw@waldmann-edv.de>
date Sat, 15 Oct 2005 16:56:39 +0000
parents 99f0d19d0285
children a54cebaab73e
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Sat Oct 15 14:55:25 2005 +0000
+++ b/MoinMoin/action/AttachFile.py	Sat Oct 15 16:56:39 2005 +0000
@@ -25,7 +25,7 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-import os, mimetypes, time, urllib, zipfile
+import os, mimetypes, time, zipfile
 from MoinMoin import config, user, util, wikiutil, packages
 from MoinMoin.Page import Page
 from MoinMoin.util import MoinMoinNoFooter, filesys, web
@@ -83,12 +83,12 @@
 
         url = "%s/%s/attachments/%s%s" % (
             request.cfg.attachments['url'], wikiutil.quoteWikinameFS(pagename),
-            urllib.quote(filename.encode(config.charset)), timestamp)
+            wikiutil.url_quote(filename), timestamp)
     else:
         # send file via CGI
         url = "%s/%s?action=%s&do=get&target=%s" % (
             request.getScriptname(), wikiutil.quoteWikinameURL(pagename),
-            action_name, urllib.quote_plus(filename.encode(config.charset)))
+            action_name, wikiutil.url_quote_plus(filename))
     if escaped:
         url = wikiutil.escape(url)
     return url
@@ -147,8 +147,7 @@
     """
     from MoinMoin.logfile import editlog
     t = wikiutil.timestamp2version(time.time())
-    # urllib always return ascii
-    fname = unicode(urllib.quote(filename.encode(config.charset)))
+    fname = wikiutil.url_quote(filename, want_unicode=True)
 
     # TODO: for now we simply write 2 logs, maybe better use some multilog stuff
     # Write to global log
@@ -214,7 +213,7 @@
             baseurl = request.getScriptname()
             action = action_name
             urlpagename = wikiutil.quoteWikinameURL(pagename)
-            urlfile = urllib.quote_plus(file.encode(config.charset))
+            urlfile = wikiutil.url_quote_plus(file)
 
             base, ext = os.path.splitext(file)
             get_url = getAttachUrl(pagename, file, request, escaped=1)
@@ -290,7 +289,7 @@
         for file in files:
             url = "%s/%s?action=%s&do=view&target=%s" % (
                 scriptName, pagename_quoted,
-                action_name, urllib.quote_plus(file.encode(config.charset)))
+                action_name, wikiutil.url_quote_plus(file))
 
             request.write(u'<link rel="Appendix" title="%s" href="%s">\n' % (
                 wikiutil.escape(file), wikiutil.escape(url)))