|
@@ -341,7 +341,7 @@ class MediaUpload(MediaPath): |
|
|
if self.validate(result, fieldStorage.file): |
|
|
if self.validate(result, fieldStorage.file): |
|
|
with open( self.mediapath(result['name'] + '.type'), 'w') as f: |
|
|
with open( self.mediapath(result['name'] + '.type'), 'w') as f: |
|
|
f.write(result['type']) |
|
|
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) |
|
|
shutil.copyfileobj( fieldStorage.file , f) |
|
|
if re.match(IMAGE_TYPES, result['type']): |
|
|
if re.match(IMAGE_TYPES, result['type']): |
|
|
result['thumbnailUrl'] = self.createthumbnail(result['name']) |
|
|
result['thumbnailUrl'] = self.createthumbnail(result['name']) |
|
@@ -388,7 +388,7 @@ class MediaView(MediaPath): |
|
|
pass |
|
|
pass |
|
|
#try: |
|
|
#try: |
|
|
if 1: |
|
|
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: |
|
|
#except IOError: |
|
|
# raise NotFound |
|
|
# raise NotFound |
|
|
return self.request.response |
|
|
return self.request.response |
|
|