#15783: Class FileProxyMixin has invalid attribute definition
-------------------------------------+-------------------------------------
               Reporter:  sebzur     |          Owner:  nobody
                   Type:  Bug        |         Status:  closed
              Milestone:             |      Component:  File
                Version:  1.3        |  uploads/storage
             Resolution:  invalid    |       Severity:  Normal
           Triage Stage:             |       Keywords:
  Unreviewed                         |      Has patch:  0
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
-------------------------------------+-------------------------------------

Comment (by sebzur):

 OK, I understand that... but the case is: `FileProxyMixin` defines
 `fileno` property, which proxies to `self.file.fileno` .. which does not
 exist.

 The fact that `self.file.fileno` does not exist (when file is e.g.
 InMemomyUploadedFile instance) is of course valid with respect to Python
 docs, but.. when I'm using an object (an instance of FileProxyMixin
 subclass) that is reporting (i.e. with dir) that **it has fileno
 attribute**, shouldn't it have it?

 I found the current FileProxyMixin definition unclear. IMHO it confuses
 programmer, who has to know, that despite the existence of the attribute,
 he can not use it.

 One can of course say, that this is somehow similar case to the case of
 abstract method raising `NonImplementedError`  being at the same time the
 existing attribute of the class, but while the Python docs states that the
 method **should not be provided** in fact **it is** (at least as a
 'reference' to `AttributeError`).

 This is just to comment what worries me here. :D Maybe `FileProxyMixin`
 should introspect `self.file` to see if it provides `fileno` before
 putting it as a proxy attr?

-- 
Ticket URL: <http://code.djangoproject.com/ticket/15783#comment:3>
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 django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to