python cgi module always returns a FieldStorage for all submitted vars. web2py tries to parse them into strings. This fails when there is a file and (by convention) web2py leaves it as FieldStorage. This is convenient because it lets you check "if.request.vars.field" before taking any action.
Massimo On Jan 22, 8:46 am, Markus Gritsch <[email protected]> wrote: > Thank you Timothy and Massimo. > > One final question: When not selecting a file to upload and just > submitting the form, > request.vars.test > is equal to an empty string, and request.vars.test.file fails with an > AttributeError: 'str' object has no attribute 'file' > > Why is request.vars.test in this case a string and not a FieldStorage > with an empty filename? > > Kind regards, > Markus --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

