[Zope] call zpt methods in dtml

nagendra prasad t_nagendraprasad@yahoo.co.in
Thu, 19 Jun 2003 07:04:04 +0100 (BST)


Hi,
thanks for the response.
this is what i have done earlier.
this is my macros in zpt (name is myZPtemplate).here
this form action points to dtml script.
-----------------------------------------------------------------
<tr tal:define="startdate request/startdate|nothing">
  <th align="left">
    <font size=5><font face="verdana"><b>
    Start Date:
    </b></font></font>
  </th>
  <td><input type="text" name="startdate"
      tal:replace="structure
python:form.startdate.render(startdate)" />
  </td>
</tr>
-----------------------------------------------------------------

this is my dtml script(talks to openflow) that tries
to call zpt
----------------------------------------------------------
<dtml-var standard_html_header>
<h2><dtml-var document_title></h2>
<p>
<dtml-let instance="workflow.addInstance('request',
  AUTHENTICATED_USER.getUserName(),
  'no comment',
  'Request for Grant by ' + 
AUTHENTICATED_USER.getUserName(),
  activation=0)"
instobj="_.getattr(workflow,instance)">

**<dtml-call "instobj.manage_addProperty('startdate',
startdate, 'string')">**

<dtml-call "workflow.startInstance(instance)">
</dtml-let>
</p>
<p>
<a hre f="index_html">To frontpage</a>
</p>
<dtml-var standard_html_footer>
------------------------------------------------------------------------
Now the line that is marked with * is replaced by 
<dtml-var expr="myZPtemplate(startdate)">
Now when i run the zpt file & click submit(reaches the
dtml file correctly) but still 
Error Type
NameError
Error Value
name 'startdate' is not defined
it always gives an error that occured earlier
i have read this doc on 
http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/AppendixC.stx
but doesn;t talk anything abt these
plz tell me what to do
what is the problem
Thanks
Prasad


>  > how do i call zpt in dtml?
> 
> Options:
> 
>   <dtml-var myZPT>
> 
>   <dtml-var expr="myZPT(a,b,c)">
> 
> The first form calls "myZPT" without parameters,
> the second with "a,b,c". In "myZPT" you can access
> arguments via
> the "options" variable (a dictionary). "args" is the
> tuple of
> positional arguments, all other keys specify keyword
> arguments.
> 
> Read more in the Zope Book (2.6 edition).
> 
> 
> Dieter
> 
> _______________________________________________
> Zope maillist  -  Zope@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 ) 

________________________________________________________________________
Send free SMS using the Yahoo! Messenger. Go to http://in.mobile.yahoo.com/new/pc/