Apache Mod-Python - Re: Field.file issue [was Re: mod_python 3.2.3b available for testing]

This is Interesting: Free IT Magazines  
Home > Archive > Apache Mod-Python > October 2005 > Re: Field.file issue [was Re: mod_python 3.2.3b available for testing]





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: Field.file issue [was Re: mod_python 3.2.3b available for testing]
Nick

2005-10-31, 5:47 pm

Just FYI for anyone who's still interested...

The fileno method only exists and returns non-negative integers for real
file streams. So that's the trick.

Nick

Nick wrote:
> Jim Gallacher wrote:
>
>
>
> Looks good. Reading this probably answers your question after next.
>
>
>
> It's important to know how to handle information coming in from a POST,
> because generically I may not know whether a field named "the_file" is
> intended as a string file name (from type="text") or a file (from
> type="file"). I don't know what the semantics of the form being
> submitted are, but I need to do something different with strings and files.
>
>
>
> Because if the Field is a string value, the file attribute is a StringIO
> (or cStringIO), which has a read attribute. hasattr(field_thing,
> 'read') should *always* return True no matter what the Field stores (see
> documentation above).
>
>
>
> Fair enough. I can check to see if file is a StringIO, or a cStringIO,
> but that's assuming that some Python implemention doesn't decide to
> return one of those from a tempfile.TemporaryFile call. It's probably
> not important enough for most people anyway since they're using
> publisher or something similar.
>
> Sorry to have wasted time on this.
>
> Nick



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com