Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #11670
| References | <92d066ff-d0ee-432f-b512-1f2fa01ba681@a12g2000yqi.googlegroups.com> |
|---|---|
| Date | 2011-08-17 10:25 +0100 |
| Subject | Re: CGI: Assign FieldStorage values to variables |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.121.1313573106.27778.python-list@python.org> (permalink) |
On Wed, Aug 17, 2011 at 10:06 AM, Gnarlodious <gnarlodious@gmail.com> 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 probably do this with some kind of list comprehension, but I
recommend against it, if this has come from a web form. You do NOT
want end users having the power to set variables. Keep it in a
separate object (such as 'form') such that you must always be explicit
about fetching form data. PHP has learned the risks; here's a decent
summary:
http://www.php.net/manual/en/security.globals.php
Chris Angelico
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
CGI: Assign FieldStorage values to variables Gnarlodious <gnarlodious@gmail.com> - 2011-08-17 02:06 -0700
Re: CGI: Assign FieldStorage values to variables Gnarlodious <gnarlodious@gmail.com> - 2011-08-17 02:19 -0700
Re: CGI: Assign FieldStorage values to variables Chris Angelico <rosuav@gmail.com> - 2011-08-17 10:41 +0100
Re: CGI: Assign FieldStorage values to variables Chris Rebert <clp2@rebertia.com> - 2011-08-17 09:23 -0700
Re: CGI: Assign FieldStorage values to variables Chris Angelico <rosuav@gmail.com> - 2011-08-17 10:25 +0100
Re: CGI: Assign FieldStorage values to variables Gnarlodious <gnarlodious@gmail.com> - 2011-08-17 20:52 -0700
Re: CGI: Assign FieldStorage values to variables Gnarlodious <gnarlodious@gmail.com> - 2011-08-17 02:20 -0700
Re: CGI: Assign FieldStorage values to variables Nobody <nobody@nowhere.com> - 2011-08-17 13:45 +0100
csiph-web