On Fri, Jan 30, 2009 at 5:08 PM, Ludvig Ericson <ludvig.eric...@gmail.com> wrote: > > On Jan 30, 2009, at 22:19, Todd O'Bryan wrote: >> >> I'm not sure I understand this. If you try to call a file-like method >> or access a file-like attribute on an UploadedFile, it would either do >> the right thing or you'd get an error saying that UploadedFile doesn't >> support it. Neither of those seems terribly astonishing. > > And then you get an AttributeError which moans about some entirely > different object, inside a foreign method. I know, you can weed it > out, but I'm not alone in staring at the asyncore exceptions.
Oh, that would be *awful*. You don't just send attribute access requests off to the backing object and cross your fingers. If I implement it, I'd try the attribute access on self._file and if it doesn't work, return a reasonable error message from the UploadedFile class rather than the error message from the backing object. Would that make this any more palatable? > The __getattr__-approach also has the side-effect of dispatching all > missing attribute accesses, which could result in oddities for other > reasons. Not that I can think of one, but it could be a source of > subtle bugs. That's what I'm mostly worried about. I can't think of any things that would obviously happen, but Python's indirection facility has gotten me in trouble more often than I like to admit. Anybody have any concrete examples of what could go wrong, rather than a generalized queasy feeling (which I must admit I share)? :-) Todd --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---