On Aug 17, 3:25 am, Chris Angelico wrote:
> You do NOT
> want end users having the power to set variables.
Thanks for the warning, I can see I will need to quarantine the form
input. And update() is out of the question.
-- Gnarlie
http://Gnarlodious.com/
--
http://mail.python.org/mailman/listinfo
On Wed, Aug 17, 2011 at 2:19 AM, Gnarlodious wrote:
> I should add that this does what I want, but something a little more
> Pythonic?
>
> import cgi, os
> os.environ["QUERY_STRING"] = "name1=Val1&name2=Val2&name3=Val3"
> form=cgi.FieldStorage()
>
> form
>
> dict = {}
> for key in form.keys(): dic
On Wed, 17 Aug 2011 02:06:31 -0700, Gnarlodious wrote:
> I get a construct like this:
>
> form=FieldStorage(None, None, [MiniFieldStorage('name1', 'Val1'),
> MiniFieldStorage('name2', 'Val2'), MiniFieldStorage('name3', 'Val3')])
>
> Now how would I assign every variable name* its value?
Don't d
I should add that this does what I want, but something a little more
Pythonic?
import cgi, os
os.environ["QUERY_STRING"] = "name1=Val1&name2=Val2&name3=Val3"
form=cgi.FieldStorage()
form
dict = {}
for key in form.keys(): dict[ key ] = form[ key ].value
dict
locals().update(dict)
name3
-- Gnarl
On Wed, Aug 17, 2011 at 10:19 AM, Gnarlodious wrote:
> import cgi, os
> os.environ["QUERY_STRING"] = "name1=Val1&name2=Val2&name3=Val3"
> form=cgi.FieldStorage()
>
> form
>
> dict = {}
> for key in form.keys(): dict[ key ] = form[ key ].value
>
You could probably use a list comp for this, but the
On Wed, Aug 17, 2011 at 10:06 AM, Gnarlodious wrote:
> I get a construct like this:
>
> form=FieldStorage(None, None, [MiniFieldStorage('name1', 'Val1'),
> MiniFieldStorage('name2', 'Val2'), MiniFieldStorage('name3', 'Val3')])
>
> when I need to assign the variable name2 the value Val2
You can pr
I should add that this does what I want, but something a little more
Pythonic?
import cgi, os
os.environ["QUERY_STRING"] = "name1=Val1&name2=Val2&name3=Val3"
form=cgi.FieldStorage()
form
dict = {}
for key in form.keys(): dict[ key ] = form[ key ].value
dict
locals().update(dict)
name3
-- Gnarl
I get a construct like this:
form=FieldStorage(None, None, [MiniFieldStorage('name1', 'Val1'),
MiniFieldStorage('name2', 'Val2'), MiniFieldStorage('name3', 'Val3')])
Now how would I assign every variable name* its value?
lI did try locals().update(form) however I get
>>> name2
-> MiniFieldStorag
I get a construct like this:
form=FieldStorage(None, None, [MiniFieldStorage('name1', 'Val1'),
MiniFieldStorage('name2', 'Val2'), MiniFieldStorage('name3', 'Val3')])
Now how would I assign every variable name* its value?
lI did try locals().update(form) however I get
>>> name2
-> MiniFieldStorag