Commit 60d2408c authored by 's avatar

Fixes to get_size

parent 63f78ddc
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""Image object""" """Image object"""
__version__='$Revision: 1.61 $'[11:-2] __version__='$Revision: 1.62 $'[11:-2]
import Globals, string, struct, mimetypes, content_types import Globals, string, struct, mimetypes, content_types
from Globals import HTMLFile, MessageDialog from Globals import HTMLFile, MessageDialog
...@@ -247,6 +247,8 @@ class File(Persistent,Implicit,PropertyManager, ...@@ -247,6 +247,8 @@ class File(Persistent,Implicit,PropertyManager,
self.dav__init(REQUEST, RESPONSE) self.dav__init(REQUEST, RESPONSE)
type=REQUEST.get_header('content-type', None) type=REQUEST.get_header('content-type', None)
body=REQUEST.get('BODY', '') body=REQUEST.get('BODY', '')
if not len(body):
raise 'bullshit', 'bullshit'
if type is None: if type is None:
type, enc=mimetypes.guess_type(self.id()) type, enc=mimetypes.guess_type(self.id())
if type is None: if type is None:
...@@ -264,7 +266,8 @@ class File(Persistent,Implicit,PropertyManager, ...@@ -264,7 +266,8 @@ class File(Persistent,Implicit,PropertyManager,
Returns the size of the file or image. Returns the size of the file or image.
""" """
return len(self.data) return len(self.data)
get_size=getSize
def getContentType(self): def getContentType(self):
"""Get the content type of a file or image. """Get the content type of a file or image.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment