#8675: File storage - Storage objects example does not work
---------------------------+------------------------------------------------
 Reporter:  whiskybar      |       Owner:  nobody    
   Status:  new            |   Milestone:            
Component:  Documentation  |     Version:  SVN       
 Keywords:                 |       Stage:  Unreviewed
Has_patch:  0              |  
---------------------------+------------------------------------------------
 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.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/8675>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to