|
| 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
|
|