aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiernov <piernov@piernov.org>2015-02-28 21:28:16 +0100
committerpiernov <piernov@piernov.org>2015-02-28 21:28:16 +0100
commit4c5f016a0db0b5758125367545bbdfca159c45b2 (patch)
tree0a2f1924332bc4a0e3e3effff843dfab7eb9a0c5
parentf487699e6aa1f39e4345d13d118132e410567652 (diff)
downloadjm2l-4c5f016a0db0b5758125367545bbdfca159c45b2.tar.gz
jm2l-4c5f016a0db0b5758125367545bbdfca159c45b2.tar.bz2
jm2l-4c5f016a0db0b5758125367545bbdfca159c45b2.tar.xz
jm2l-4c5f016a0db0b5758125367545bbdfca159c45b2.zip
Files should be opened in binary mode
-rw-r--r--jm2l/upload.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/jm2l/upload.py b/jm2l/upload.py
index 0feeb3b..a1eadc0 100644
--- a/jm2l/upload.py
+++ b/jm2l/upload.py
@@ -341,7 +341,7 @@ class MediaUpload(MediaPath):
if self.validate(result, fieldStorage.file):
with open( self.mediapath(result['name'] + '.type'), 'w') as f:
f.write(result['type'])
- with open( self.mediapath(result['name']), 'w') as f:
+ with open( self.mediapath(result['name']), 'wb') as f:
shutil.copyfileobj( fieldStorage.file , f)
if re.match(IMAGE_TYPES, result['type']):
result['thumbnailUrl'] = self.createthumbnail(result['name'])
@@ -388,7 +388,7 @@ class MediaView(MediaPath):
pass
#try:
if 1:
- self.request.response.body_file = open( self.mediapath(name), 'r', 10000)
+ self.request.response.body_file = open( self.mediapath(name), 'rb', 10000)
#except IOError:
# raise NotFound
return self.request.response