aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--django/__init__.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/django/__init__.py b/django/__init__.py
index 7027c19..159a552 100644
--- a/django/__init__.py
+++ b/django/__init__.py
@@ -61,13 +61,19 @@ class S3Storage(Storage):
61 61
62 def _save(self, filename, content): 62 def _save(self, filename, content):
63 # a stupid hack 63 # a stupid hack
64 content = content.file 64 #content = content.file
65 try: 65 try:
66 data = content.read() 66 data = content.read()
67 except IOError, err: 67 except IOError, err:
68 raise S3Error, 'Unable to read %s: %s' % (filename, err.strerror) 68 raise S3Error, 'Unable to read %s: %s' % (filename, err.strerror)
69 69
70 if not content.content_type: 70 guess_type = False
71 try:
72 content.content_type
73 except AttributeError, e:
74 guess_type = True
75
76 if guess_type or not content.content_type:
71 import mimetypes 77 import mimetypes
72 content_type = mimetypes.guess_type(filename)[0] 78 content_type = mimetypes.guess_type(filename)[0]
73 if content_type is None: 79 if content_type is None: