#13531: django.core.files.File throws an exception on _get_size
------------------------------------+---------------------------------------
          Reporter:  aarond10       |         Owner:  nobody         
            Status:  reopened       |     Milestone:                 
         Component:  Uncategorized  |       Version:  1.2-beta       
        Resolution:                 |      Keywords:  File, Exception
             Stage:  Unreviewed     |     Has_patch:  0              
        Needs_docs:  0              |   Needs_tests:  0              
Needs_better_patch:  0              |  
------------------------------------+---------------------------------------
Changes (by douglasbagnall):

  * status:  closed => reopened
  * resolution:  invalid =>

Comment:

 If the file does not have a name (for example, is a StringIO object), the
 AttributeError is at line 39 in django/core/files/base.py (svn trunk):

 {{{
     def _get_size(self):
         if not hasattr(self, '_size'):
             if hasattr(self.file, 'size'):
                 self._size = self.file.size
             elif os.path.exists(self.file.name):   #<-----------HERE
                 self._size = os.path.getsize(self.file.name)
             else:
                 raise AttributeError("Unable to determine the file's
 size.")
         return self._size
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/13531#comment:2>
Django <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