diff MoinMoin/action/AttachFile.py @ 5591:1dff6cfdcf90

http headers: for most cases, do not use .add, but .__setitem__
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 27 Feb 2010 02:04:17 +0100
parents 4a50a70af35d
children 78f1be3c8777
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Fri Feb 26 10:32:03 2010 +0100
+++ b/MoinMoin/action/AttachFile.py	Sat Feb 27 02:04:17 2010 +0100
@@ -818,13 +818,13 @@
         content_dispo = dangerous and 'attachment' or 'inline'
 
         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('Expires', http_date(now - 365 * 24 * 3600))
-        #request.headers.add('Content-Length', os.path.getsize(fpath))
+        request.headers['Date'] = http_date(now)
+        request.headers['Content-Type'] = content_type
+        request.headers['Last-Modified'] = http_date(timestamp)
+        request.headers['Expires'] = http_date(now - 365 * 24 * 3600)
+        #request.headers['Content-Length'] = os.path.getsize(fpath)
         content_dispo_string = '%s; filename="%s"' % (content_dispo, filename_enc)
-        request.headers.add('Content-Disposition', content_dispo_string)
+        request.headers['Content-Disposition'] = content_dispo_string
 
         # send data
         request.send_file(ci.get(filename))
@@ -859,13 +859,13 @@
         content_dispo = dangerous and 'attachment' or 'inline'
 
         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('Expires', http_date(now - 365 * 24 * 3600))
-        request.headers.add('Content-Length', os.path.getsize(fpath))
+        request.headers['Date'] = http_date(now)
+        request.headers['Content-Type'] = content_type
+        request.headers['Last-Modified'] = http_date(timestamp)
+        request.headers['Expires'] = http_date(now - 365 * 24 * 3600)
+        request.headers['Content-Length'] = os.path.getsize(fpath)
         content_dispo_string = '%s; filename="%s"' % (content_dispo, filename_enc)
-        request.headers.add('Content-Disposition', content_dispo_string)
+        request.headers['Content-Disposition'] = content_dispo_string
 
         # send data
         request.send_file(open(fpath, 'rb'))