Re: [Django] #15783: Class FileProxyMixin has invalid attribute definition

2011-04-21 Thread Django
#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):

 OKay - now I see it! This comment helps me a little.  You're right the
 when You're looking on this with hasattr, there's no 'fileno', and
 everything is **perfectly okay**.

 My 'fault' was, that I was looking on this firstly with `dir`, which
 simply listed 'fileno' as attr and than I was trying to use it. I was also
 looking into the code, where I also saw 'fileno' implemented.

 So I thing it should be left as it is... but there's still a tiny bit of
 hesitation in me when I'm thinking abut it...

 (fileno behaviour is like taken from the quantum mechanics: You know that
 it's not there only if You really try to touch it.) :D

 Anyway - thanks for the discussion!

-- 
Ticket URL: 
Django 
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.



Re: [Django] #15783: Class FileProxyMixin has invalid attribute definition

2011-04-21 Thread Django
#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 jonash):

 From the runtime's point of view (`hasattr`/`getattr`), it doesn't have a
 `fileno` attribute.
 {{{>>> class Foo(object):
 ...   @property
 ...   def fileno(self):
 ... raise AttributeError
 ...
 >>> hasattr(Foo(), 'fileno')
 False}}}

-- 
Ticket URL: 
Django 
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.



Re: [Django] #15783: Class FileProxyMixin has invalid attribute definition

2011-04-21 Thread Django
#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: 
Django 
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.



Re: [Django] #15783: Class FileProxyMixin has invalid attribute definition

2011-04-21 Thread Django
#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
-+-
Changes (by jonash):

 * status:  new => closed
 * resolution:   => invalid
 * easy:   => 0


Comment:

 From the Python documentation:

 file.fileno()
 [...]
 File-like objects which do not have a real file descriptor should
 *not* provide
 this method!

 That's exactly what Django does: Raising an ``AttributeError`` for file-
 likes that have no ``fileno``.

-- 
Ticket URL: 
Django 
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.



Re: [Django] #15783: Class FileProxyMixin has invalid attribute definition

2011-04-07 Thread Django
#15783: Class FileProxyMixin has invalid attribute definition
--+
   Reporter:  sebzur  |Owner:  nobody
   Type:  Bug |   Status:  new
  Milestone:  |Component:  File uploads/storage
Version:  1.3 | Severity:  Normal
 Resolution:  | Keywords:
   Triage Stage:  Unreviewed  |Has patch:  0
Needs documentation:  0   |  Needs tests:  0
Patch needs improvement:  0   |
--+
Changes (by sebzur):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 I think I was not not much verbose with the ticket, so some more info
 below:

 The error occurs when handling uploded file, that was not save and is in
 fact InMemoryUploadedFile object. Then, InMemoryUploadedFile instance does
 not have fileno attribute working correctly.

-- 
Ticket URL: 
Django 
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.