diff options
| author | jason | 2010-01-07 10:14:43 -0700 |
|---|---|---|
| committer | jason | 2010-01-07 10:14:43 -0700 |
| commit | afe12af07f210ada0b048ef3efb3baeb540ab2dd (patch) | |
| tree | aa4015b729ee23b058f4fc0d2ca4346f4238df5a /django/__init__.py | |
| parent | 1196f449a3f2faa7267949e586f12920eb2194a2 (diff) | |
| download | amazons3-py-afe12af07f210ada0b048ef3efb3baeb540ab2dd.tar.gz amazons3-py-afe12af07f210ada0b048ef3efb3baeb540ab2dd.zip | |
Removed a hack that was breaking stuff
Diffstat (limited to 'django/__init__.py')
| -rw-r--r-- | django/__init__.py | 10 |
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: |