changeset 5202:c5244b636870

merged main
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 10 Oct 2009 14:12:14 +0200
parents 3b9b517aecbe (current diff) a3c6d7b7a5dd (diff)
children 03086aa93c85
files
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Sat Oct 10 14:11:17 2009 +0200
+++ b/MoinMoin/action/AttachFile.py	Sat Oct 10 14:12:14 2009 +0200
@@ -30,6 +30,8 @@
 import os, time, zipfile, errno, datetime
 from StringIO import StringIO
 
+from werkzeug import http_date
+
 from MoinMoin import log
 logging = log.getLogger(__name__)
 
@@ -776,9 +778,11 @@
         dangerous = mime_type in request.cfg.mimetypes_xss_protect
         content_dispo = dangerous and 'attachment' or 'inline'
 
-        request.content_type = content_type
-        request.last_modified = timestamp
-        #request.content_length = os.path.getsize(fpath)
+        now = time.time()
+        request.headers.add('Date', http_date(now))
+        request.headers.add('Content-Type', content_type)
+        request.headers.add('Last-Modified', http_date(timestamp))
+        #request.headers.add('Content-Length', os.path.getsize(fpath))
         content_dispo_string = '%s; filename="%s"' % (content_dispo, filename_enc)
         request.headers.add('Content-Disposition', content_dispo_string)
 
@@ -814,9 +818,11 @@
         dangerous = mime_type in request.cfg.mimetypes_xss_protect
         content_dispo = dangerous and 'attachment' or 'inline'
 
-        request.content_type = content_type
-        request.last_modified = timestamp
-        request.content_length = os.path.getsize(fpath)
+        now = time.time()
+        request.headers.add('Date', http_date(now))
+        request.headers.add('Content-Type', content_type)
+        request.headers.add('Last-Modified', http_date(timestamp))
+        request.headers.add('Content-Length', os.path.getsize(fpath))
         content_dispo_string = '%s; filename="%s"' % (content_dispo, filename_enc)
         request.headers.add('Content-Disposition', content_dispo_string)