Hi all, Can someone show me how to call a DTML Method from a python script? Thanks, -- Mike Tran Shufflemaster Gaming Inc.
On Fri, Nov 30, 2001 at 09:39:35AM -0700, Mike Doanh Tran wrote:
Hi all,
Can someone show me how to call a DTML Method from a python script?
Look at: http://www.zopelabs.com/cookbook/992031125
Thanks,
-- Mike Tran Shufflemaster Gaming Inc.
_______________________________________________ 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 )
A couple of ways to do it: # of if _ is bound to the (Script) Python in the bindings tab print _.getitem('methodName') # 1. No passing of parms, gets object via acquisition print container.methodName(context, _) # 2. if it exists in the same folder or container as the python script print container.methodName(context, _, someParm='Some Value') # This makes a some value show up inside # of the dtml method namespace, ie <dtml-var someParm> will work. Great for passing stuff into a function # without having to clutter REQUEST. # If you want to use acquisition and pass parms... myFunction = _.getitem('methodName') # 3. Find the function in the namespace print myFunction(context, _, someParm='Some Value') # Print it (or do something else with it.) return printed -Chris ------------------------------ Chris Kratz chris.kratz@vistashare.com ----- Original Message ----- From: "Mike Doanh Tran" <mtran@shufflemasterrd.com> To: <zope@zope.org>; <lazug@lazug.org> Sent: Friday, November 30, 2001 11:39 AM Subject: [Zope] calling dtml methods from python
Hi all,
Can someone show me how to call a DTML Method from a python script?
Thanks,
-- Mike Tran Shufflemaster Gaming Inc.
_______________________________________________ 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 )
participants (3)
-
Chris Kratz -
Jim Penny -
Mike Doanh Tran