Hi Chris My initial guess would have been to try: return context._['test_thang'] I thought context gave you access to the namespace. Am I wrong? On Thu, May 24, 2001 at 10:51:41AM +0100, Chris Withers wrote:
Hi,
I want to call a python script from DTML and pass the namespace, the trouble is, the PS needs to be called from a python expression in DTML.
So, taking the simple DTML method: <dtml-var standard_html_header> <dtml-let test_thang="'Test Thang'"> <dtml-var "test_ps" html_quote> </dtml-let> <dtml-var standard_html_footer>
...and a simple python script (with namespace bound to _): return _['test_thang']
..which of coruse, doesn't work, it gives me: <PythonScript instance at 01B17ED0>
..so change <dtml-var "test_ps" html_quote> to <dtml-var "test_ps()" html_quote> and now I get: Error type: KeyError Error value: test_thang
...fair enough thinks me, I need to do the old dtml trick and so change to: <dtml-var "test_ps(_.None,_)" html_quote> ...and now I get: Error type: TypeError Error value: no arguments expected
...OK, irritating, but lets try changing the parameter list to 'context, _': Finally I get what I want: Test Thang
However, now I want to call it somewhere else as just <dtml-var test_ps>, I get: Error type: TypeError Error value: not enough arguments; expected 2, got 0
...at this point my head exploded and I thought I'd mail the list. Can anyone explain how Ishould eb doing this?
cheers,
Chris
_______________________________________________ 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 ------------------------------------------------------