On Thu, Jan 29, 2009 at 9:28 PM, Malcolm Tredinnick <malc...@pointy-stick.com> wrote: > > On Thu, 2009-01-29 at 15:40 -0500, Todd O'Bryan wrote: >> I'm trying to validate an uploaded csv file, so I want to read the >> first line of text and if it's not the right format, send an error >> message. Unfortunately, neither InMemoryUploadedFile nor >> TemporaryUploadedFile have the readline() method. >> >> Was that an oversight (in which case I'll create a two-line patch and >> submit it--both StringIO and temp files support the method) or a >> design decision with a good reason? > > It's a flaw in Python: what an object needs to be "file-like" is not > well defined. Different users require different things. A file doesn't > really need a readlines() method, except when it does, etc. > > There's about half a dozen tickets open for "add X, Y or Z" to the file > stuff, so look through those first. > > Regards, > Malcolm >
OK. I proxied every file-like object method or attribute listed in the Python docs. If something doesn't work now it's because the object that backs the UploadedFile doesn't support it, not because we forgot to provide a proxy to it. http://code.djangoproject.com/ticket/9404 Todd --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---