[Zope] Seeing a DTML-LET from a Python Script?

Jean Jordaan jean@upfrontsystems.co.za
Thu, 28 Feb 2002 16:50:39 +0200


Hi Lennart, Joel

Lennart:
> I'm not sure, but maybe it's accessible as context.somevariable?

That would be great, but hasattr(context, 'somevariable') doesn't
help .. 

> If not you could pass it to the pythonscript: <dtml-var
> "pythonscript(somevariable)">
> Thats a cleaner and better way to do it anyway.

I can't .. I'm one step away from the calling method. This is what
I'm trying to do:

caller:

  <dtml-let control="control_name">
  <dtml-var "dtmlmethod(this(), _)">
  </dtml-let>

dtmlmethod:

  <dtml-let state="pythonscript(param, param, ..)">
  ...
  </dtml-let>

pythonscript:

  return _['control']

This does not work. 

I've found that, in this simple case, it works if I do this:
  <dtml-let state=pythonscript>
and this also works:
  <dtml-let state="pythonscript(_)">
if _ is defined as a parameter in pythonscript. I need to pass 
parameters, and I'd rather not need to pass a "magic" _ as first
parameter .. 

-- 
Jean Jordaan
Upfront Systems                         http://www.upfrontsystems.co.za