diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-07-13 16:12:01 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-07-13 16:12:01 +0200 | 
| commit | 5bc55326afc6d9e26dd8583293ec038daf1971e3 (patch) | |
| tree | a4ec1a70d738ce898b809ca2a182ed9188479baf | |
| parent | 2257ac06f8721181a3b491bf1b750659ada85e46 (diff) | |
| download | Ishtar-5bc55326afc6d9e26dd8583293ec038daf1971e3.tar.bz2 Ishtar-5bc55326afc6d9e26dd8583293ec038daf1971e3.zip  | |
Arbitrary put a size on temp file in imports
| -rw-r--r-- | ishtar_common/data_importer.py | 4 | 
1 files changed, 4 insertions, 0 deletions
diff --git a/ishtar_common/data_importer.py b/ishtar_common/data_importer.py index a2d1f40d2..481098244 100644 --- a/ishtar_common/data_importer.py +++ b/ishtar_common/data_importer.py @@ -495,11 +495,15 @@ class FileFormater(Formater):          filename = settings.MEDIA_ROOT + 'imported/' + \              u".".join(items[:-1]) + u'.' + items[-1]          try: +            current_size = 0              with open(filename, 'w') as f:                  with zp.open(value) as z:                      f.write(z.read()) +                current_size = f.size              f = open(filename, 'r')              my_file = File(f) +            # manualy set the file size because of an issue with TempFile +            my_file.size = current_size              return my_file          except KeyError:              raise ValueError(_(u"\"%(value)s\" is not a valid path for the "  | 
