changeset 382:0fd6527bd6aa

merged
author Michael Mayorov <marchael@kb.csu.ru>
date Mon, 01 Aug 2011 20:57:48 +0000
parents f720cf1e8969 (current diff) a50ded41a60d (diff)
children ea543ad2fb6c
files MoinMoin/items/__init__.py setup.py
diffstat 3 files changed, 27 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/items/__init__.py	Mon Aug 01 20:57:04 2011 +0000
+++ b/MoinMoin/items/__init__.py	Mon Aug 01 20:57:48 2011 +0000
@@ -1133,7 +1133,7 @@
         # TODO: use registry as soon as it is in there
         from MoinMoin.converter.pygments_in import Converter as PygmentsConverter
         pygments_conv = PygmentsConverter(contenttype=self.contenttype)
-        doc = pygments_conv(data_text.split(u'\n'))
+        doc = pygments_conv(data_text)
         # TODO: Real output format
         html_conv = reg.get(type_moin_document, Type('application/x-xhtml-moin-page'))
         doc = html_conv(doc)
--- a/MoinMoin/util/send_file.py	Mon Aug 01 20:57:04 2011 +0000
+++ b/MoinMoin/util/send_file.py	Mon Aug 01 20:57:48 2011 +0000
@@ -24,10 +24,21 @@
 from time import time
 from zlib import adler32
 
-from werkzeug import Headers, wrap_file
+from werkzeug import Headers, wrap_file, url_quote
 from flask import current_app, request
 
 
+def encode_rfc2231(value, coding='UTF-8', lang=''):
+    """
+    Encode a value according to RFC2231/5987.
+
+    :param value: the value to encode. must be either unicode or encoded in <coding>.
+    :param coding: the coding (charset) to use. it is a good idea to use 'UTF-8'.
+    :param lang: the language to use. defaults to empty string (no language given).
+    """
+    return "%s'%s'%s" % (coding, lang, url_quote(value, charset=coding))
+
+
 def send_file(filename=None, file=None,
               mimetype=None,
               as_attachment=False, attachment_filename=None,
@@ -107,7 +118,10 @@
             if not filename:
                 raise TypeError('filename unavailable, required for sending as attachment')
             attachment_filename = os.path.basename(filename)
-        headers.add('Content-Disposition', 'attachment', filename=attachment_filename)
+        # Note: we only give filename* param, not filename param, hoping that a user agent that
+        # does not support filename* then falls back into using the last URL fragment (and decodes
+        # that correctly). See there for details: http://greenbytes.de/tech/tc2231/
+        headers.add('Content-Disposition', 'attachment; filename*=%s'% encode_rfc2231(attachment_filename))
 
     if current_app.use_x_sendfile and filename:
         if file:
--- a/setup.py	Mon Aug 01 20:57:04 2011 +0000
+++ b/setup.py	Mon Aug 01 20:57:48 2011 +0000
@@ -86,20 +86,18 @@
         'Jinja2>=2.5', # template engine
         'pygments>=1.1.1', # src code / text file highlighting
         'sqlalchemy>=0.6.0', # metadata index and other stuff
-        #'Werkzeug>=0.7dev', # wsgi toolkit, dev version (do not use ==0.7dev!)
-        'Werkzeug==0.6.2', # use this if 0.7dev fails
+        'Werkzeug>=0.6.2', # wsgi toolkit
         'py==1.3.4', # py.test 1.3.4 is needed by unit tests
         'sphinx', # needed to build the docs
-        # pin specific versions that conform to XStatic 0.0.2:
-        'XStatic==0.0.2',
-        'XStatic-CKEditor==3.6.1.2',
-        'XStatic-jQuery==1.6.1.4',
-        'XStatic-jQuery-File-Upload==4.4.2',
-        'XStatic-svgweb==2011.2.3.2',
-        'XStatic-TWikiDraw-moin==2004.10.23.2',
-        'XStatic-AnyWikiDraw==0.14.2',
-        'XStatic-MathJax==1.1.2',
-        'XStatic-svg-edit-moin==2011.07.07.2',
+        'XStatic>=0.0.2',
+        'XStatic-CKEditor>=3.6.1.2',
+        'XStatic-jQuery>=1.6.1.4',
+        'XStatic-jQuery-File-Upload>=4.4.2',
+        'XStatic-svgweb>=2011.2.3.2',
+        'XStatic-TWikiDraw-moin>=2004.10.23.2',
+        'XStatic-AnyWikiDraw>=0.14.2',
+        'XStatic-MathJax>=1.1.2',
+        'XStatic-svg-edit-moin>=2011.07.07.2',
     ],
     # optional features and their list of requirements
     extras_require = {