[ZPT] How to translate <dtml-call MyMethod> to ZPT

Jeff Peterson jpeterso@rangebroadband.com
Wed, 23 Jan 2002 11:28:15 -0600


I am not sure if this is the most clever solution but I think it will work

Create a python script:

doInsert:

R = context.REQUEST

if R.form.submit == 'Insert':
  context.InsertMethod(R)
  print 'Your data was inserted!'
else:
  print 'No Insert'

return printed


then in ZPT do:

<div tal:content="python: doInsert()"/>Insert yes/no?</div>


--
Jeffrey D. Peterson
Webmaster & Resident Standards Warrior
"The Trouble with doing anything right the first time is that nobody
appreciates how difficult it was."

> -----Original Message-----
> From: zpt-admin@zope.org [mailto:zpt-admin@zope.org]On Behalf Of Damir
> Bartakovic
> Sent: Wednesday, January 23, 2002 10:38 AM
> To: zpt@zope.org
> Subject: [ZPT] How to translate <dtml-call MyMethod> to ZPT
>
>
> Hi there once again,
>
> First thanks Richard for the tip with the "structure" option.
>
> Now I have another small problem.
> I want to replace following dtml with ZPT.
>
> <dtml-if "submit=='Insert'">
>    <dtml-call "InsertMethod(REQUEST)">
>    Your data was inserted!
> </dtml-if>
>
>
>
> The dtml-if part seems to work with:
>
> <div tal:define="submit request/form/submit">
>   <div tal:condition="python: submit !='Insert'">
>     Your data was inserted!
>   </div>
> </div>
>
> but how to call the SQL-Method from ZPT?
> I don't think one of the tal statements are meant for that.
> (define, attributes, condition, content, replace, repeat, on-error,
> omit-tag)
>
> Best regards
> Damir
>
>
> _______________________________________________
> ZPT mailing list
> ZPT@zope.org
> http://lists.zope.org/mailman/listinfo/zpt
>