changeset 4226:b2df0c84140f

Fixed handling of if_modified headers (threw exception on attachment-get)
author Florian Krupicka <florian.krupicka@googlemail.com>
date Wed, 16 Jul 2008 17:23:21 +0200
parents 54b6f63ae411
children b459b036f263
files MoinMoin/action/AttachFile.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Wed Jul 16 17:10:01 2008 +0200
+++ b/MoinMoin/action/AttachFile.py	Wed Jul 16 17:23:21 2008 +0200
@@ -27,7 +27,7 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-import os, time, zipfile, mimetypes, errno
+import os, time, zipfile, mimetypes, errno, datetime
 
 from MoinMoin import log
 logging = log.getLogger(__name__)
@@ -791,9 +791,9 @@
     if not filename:
         return # error msg already sent in _access_file
 
-    timestamp = os.path.getmtime(fpath)
-    if_modified = time.mktime(request.if_modified_since.timetuple())
-    if if_modified >= timestamp:
+    timestamp = datetime.datetime.fromtimestamp(os.path.getmtime(fpath))
+    if_modified = request.if_modified_since
+    if if_modified and if_modified >= timestamp:
         request.status_code = 304
     else:
         mt = wikiutil.MimeType(filename=filename)