[Zope] Python Scripts and HTML Forms

Muk Yan myan at umich.edu
Thu Aug 17 16:20:20 EDT 2006


Hey Jonathan, All,

Thanks I tried your solution, but it doesn't seem to work.  Can anybody shed
some more light on this situation, since what Jonathan provides is exactly
what I want to do, but it's not working.

Am I forgetting to put parameteres or some other newbie mistake like that?

Thanks in advance and thanks again Jonathan.

-Muk

On 8/17/06, Jonathan <dev101 at magma.ca> wrote:
>
>  Form variables are stored in REQUEST. In a python script you gain access
> to REQUEST by:
>
> REQUEST = container.REQUEST
> you can then access the form variables by:
>
> fname = REQUEST['first_name']
>
>
> you can check for the presence of a form variable by
>
> if REQUEST.has_key('first_name'):
>
> or
>
> if REQUEST.get('first_name', None):
>
>
> hth
>
> Jonathan
>
>
> ----- Original Message -----
> *From:* Muk Yan <myan at umich.edu>
> *To:* zope at zope.org
> *Sent:* Thursday, August 17, 2006 2:57 PM
> *Subject:* [Zope] Python Scripts and HTML Forms
>
> Dear Trusted Zope Zealots,
>
> This subject was a bit too broad to do a google search on, because I've
> tried and the lack of relevancy was astounding.
>
> I've probably been committing a cardinal sin in DTML, but I couldn't
> figure any other work around.
>
> I have an HTML form in a DTML Document say:
>
> <form action="process_this_form" method="post"
>
> Name:<input type="text" name:"first_name">
>
> </form>
>
> I want to use "first_name" in a python script, but what I've been doing is
> setting it in the process_this_form, which is a DTML method:
>
> DTML Method, process_this_form:
> <dtml-call "REQUEST.SESSION.set ('firstName', first_name)>
> <dtml-call "this_is_a_python_script()">
>
> and in the Python Script, this_is_a_python_script
> I use REQUEST.SESSION.get('firstName')
>
> What my question is, is there anyway to directly access "first_name" from
> the form in the python script without having to have to call the <dtml-call
> " REQUEST.SESSION.set('firstName', first_name)> and then
> REQUEST.SESSION.get('firstName') in the python script.  Sort of a
> sophomoric question, but any help would be appreciated.  Thanks in advance.
>
> -Muk
>
> ------------------------------
>
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20060817/9bda87f6/attachment.htm


More information about the Zope mailing list