Changes between Version 2 and Version 4 of Ticket #26495
- Timestamp:
- 04/13/16 05:41:32 (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #26495
-
Property
Summary
changed from
Storage save method wraps StringIO in File object which is identified as False.
toSaving StringIO using custom storage class may result in empty content written to file
-
Property
Summary
changed from
-
Ticket #26495 – Description
v2 v4 9 9 content = File(content) 10 10 }}} 11 For example if custom storage uses requests with post query .11 For example if custom storage uses requests with post query and we are saving StringIO object. 12 12 {{{ 13 13 #!python 14 from StringIO import StringIO 15 16 from django.core.files.storage import Storage 14 17 import requests 15 class CustomStorage(object): 18 19 class CustomStorage(Storage): 16 20 def _save(self, name, content, max_length=None): 17 21 requests.post('http://testhost.org/upload', data=content) 22 custom_storage = CustomStorage() 23 custom_storage.save('new_name', StringIO('content')) 18 24 }}} 19 25 But it will result in empty upload as bool(content) is False.