Jim Gallacher wrote:
Are you sure there is anything to correct? In both cases, the object has the same methods available for manipulating files (t.write('a'), for example). They are not the same type of object, so they have different dir() output, but don't they have the same functionality? What specifically gets broken in util.FieldStorage?

No, I'm not sure. Now that I play around with it I'm not sure I understand the problem at all. Perhaps Nick could elaborate?
[...]
Other than the fact that "isinstance(t, FileType): returns False, I don't see the problem. Nick?

There's 2 issues. I think a documentation change in mod_python where it states that a file object is returned to say a file-like object instead is one. That's easy.

The other is that there isn't an easy way to tell whether what you've got in the field is a file or not, because no matter what you've got something that "looks" like a file. Under the current documentation you could have tried isinstance(field.file, file), but that's clearly not the right thing to do since TemporaryFile doesn't necessarily return an actual file object. I accept that, but there needs to be an easy way to know what type the Field object value is -- string or file. Checking filename or disposition is obtuse, and there may not necessarily be a file name even if you get a file.

So that's my problem, or at least that's where the conversation has led me. Is there an easy way to figure out what you've got other than process of elimination?

Thanks,
Nick

Reply via email to