Simone Marzola  committed f6d45d2

set the thumb file name, so boto can guess the mimetype

  • Participants
  • Parent commits 21ba547
  • Branches s3

Comments (0)

Files changed (1)

File tgext/datahelpers/

 import Image, os
-from cStringIO import StringIO
+from StringIO import StringIO
 from boto.s3.connection import S3Connection
 from boto.s3.key import Key
 from fields import AttachedFile
         return self.s3_key.generate_url(config.get('s3_expire', 3600))
     def write(self):
-        if getattr(self.file, 'type', None):
+        if hasattr(self.file, 'type'):
             self.s3_key.set_metadata('Content-Type', self.file.type)
         self.s3_key.set_contents_from_file(self.file, policy='public-read')
         temp_file = StringIO()
+ = self.thumb_local_path
         self.s3_key.set_contents_from_file(temp_file, policy='public-read')