[Zope] passing object from dtml to python script

andres@corrada.com andres@corrada.com
Mon, 14 May 2001 22:20:25 -0400


Yes its possible to pass objects to scripts you call in dtml.

One way to fix your syntax error is to write:

<form method="post" action="<dtml-var "complete_or_not(x)" url>" ... >

But that will just create the url where your user will go once they click
their button.

If you want to avoid passing hidden fields take a look at the 
CoreSessionTracking product.

In general you can call a script with something like:

<dtml-var "someScrip(mySpecialObject=x)">

or

<dtml-call "someScriptWhoseSideEffectsIDoNotWantToSee(mySpecialObject=x)">

On Mon, May 14, 2001 at 04:11:41PM -0700, Luby Liao wrote:
> 
> Is it possible to pass objects in a dtml, such as a row of the result
> set of a sql query, into a python script used as a form handler?
> 
> As an example, on line 9, 'complete_or_not' is a python script with
> one argument.  I would like to pass an object x (line 2) into the
> script.  But the syntax of line 9 is incorrect.  I could effectively
> pass x in using hidden fields.  But I hope I can avoid that.  Any help
> is greatly appreciated.  cheers, Luby
> 
> 
>  1	 <dtml-if email>
>  2	  <dtml-let x=emailSearch>
>  3	    <dtml-if "_.len(x)==1">
>  4		<dtml-in x>
>  5		  If you are <dtml-var firstname> <dtml-var lastname>, please 
>  6	            proceed to complete the registration, by clicking the
>  7			'complete' button.  Otherwise, click the 'not me'
>  8			button.
>  9		   <FORM METHOD="POST" ACTION="complete_or_not(x)>" NAME="complete" onSubmit="return verifyInput()">
> 10		   <TABLE border="0" cellpadding="0"><TR><TD align="right">
> 11		   <INPUT TYPE="submit" NAME="complete" VALUE="Complete"></TD><TD align="right">
> 12		   <INPUT TYPE="submit" NAME="not_me" VALUE="Not Me"></TD></TR>
> 13		   </TABLE>
> 14		   </FORM>
> 15		 </dtml-in>
> 16	    </dtml-if>
> 17	   </dtml-let>
> 18	 </dtml-if>
> 
> --
> Luby Liao, Department of Math/CS, University of San Diego, San Diego, CA 92110
> (619)260-4021(O), (619)452-7644(H), (619)260-4293(fax)
> 
>    'Twas brillig, and the slithy toves    Did gyre and gimble in the wabe:
>    All mimsy were the borogroves    And the mome raths outgrabe   -- L.C.
> 
> 
> 
> 
> 
> 
> 
>                                                   
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
> 

-- 
------------------------------------------------------
Andres Corrada-Emmanuel   Email: andres@corrada.com
Internet Programming      http://www.mamey.com
------------------------------------------------------