Just in case you don't recall what this was about:

If I had a for like this:

upl_form = web.form.Form(
    web.form.File(name='upload')
)


I cannot do this with current web.py (master HEAD):

f = upl_form()
f.validates()
assert f.upload.filename
assert f.upload.value
assert f.upload.file

The patch makes this possible without any arguments to upl_form required.

It also enables me to use web.input directly without explicitly
specifying any defaults. So:

i = web.input()
assert i.upload.filename
assert i.upload.value
assert i.upload.file


On Thu, Jan 28, 2010 at 1:42 AM, Branko Vukelic <[email protected]> wrote:
> If you remember one of my topics a day or two ago, where I discussed
> file uploading, you may also recall the issues I had with it.
>
> Here's a fix for those issues. The commits do not break backwards 
> compatibility.
>
>
> Fix for web.form.File class that maps the cgi.FieldStorage's
> attributes to File instance attributes.
>
> http://github.com/foxbunny/webpy/commit/e4f26ea45f8f54bc79f4b6816075940d6ffe9539
>
>
> Fix to feed web.input so that web.form.File can be correctly populated:
>
> http://github.com/foxbunny/webpy/commit/ddcefbbddc6626b8e5e17af9531ee4f050c88073
>
>
> An alternative to the above would be to hack storify which is, indeed,
> _a hack_, but should be far more efficient than modifying web.input:
>
> http://github.com/foxbunny/webpy/commit/f4c7dac2d64a47fb263b46e51d3913b220a9134b
>
>
> Please tell me what you think, and if this can be done more
> efficiently. Justin's suggestion was to implement a modified web.input
> as web.file_input, or web.multipart_input, but I find it less
> intuitive.
>
>
>
> --
> Branko Vukelić
>
> http://foxbunny.tumblr.com/
> http://www.flickr.com/photos/16889...@n04/
> http://www.twitter.com/foxbunny
> http://github.com/foxbunny
>



-- 
Branko Vukelić

http://foxbunny.tumblr.com/
http://www.flickr.com/photos/16889...@n04/
http://www.twitter.com/foxbunny
http://github.com/foxbunny

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" 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/webpy?hl=en.

Reply via email to