tickets: 8675
This data as json
id | created | changetime | last_pulled_from_trac | stage | status | component | type | severity | version | resolution | summary | description | owner | reporter | keywords | easy | has_patch | needs_better_patch | needs_tests | needs_docs | ui_ux |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8675 | 2008-08-29 09:44:21 | 2008-08-29 09:52:49 | 2022-03-06 03:42:52.683218 | Unreviewed | closed | Documentation | dev | duplicate | File storage - Storage objects example does not work | The example at the beginning of http://www.djangoproject.com/documentation/files/#storage-objects does not work. {{{ >>> from django.core.files.storage import default_storage >>> path = default_storage.save('/path/to/file', 'new content') }}} will give you an error: {{{ <type 'exceptions.AttributeError'>: 'str' object has no attribute 'chunks' }}} The way to fix is to pass ContentFile('new content') from django.core.files.base. In fact, other examples should be double checked if they expect a string or a ContentFile-like object. See http://groups.google.com/group/django-users/browse_thread/thread/230a8601a4839bd9 for more information. | nobody | whiskybar | 0 | 0 | 0 | 0 | 0 | 0 |