[Zope] HTML() and external methods

Albert Ting alt@sonic.net
Mon, 23 Jul 2001 22:58:51 -0700


I'm creating some external methods and rather than having my python script
call a dtml method, I'd prefer to have it call a HTML instance.  So I've
been doing something like:

  testHTML = HTML('''<dtml-var hello>''')

  def externalMethod(self):
      return testHTML(self,hello="albert")

This seems to work as expected.  However, if the externalMethod was called
from a form action, and the "hello" variable was defined in the form, I'm
unable to do something like:

  def externalMethod(self):
      return testHTML(self)

or

  def externalMethod(self):
      return testHTML(self,REQUEST=self.REQUEST)

Instead, I have to do

  def externalMethod(self):
      return testHTML(self,hello=self.REQUEST['hello'])

What's the correct way to do this?

Thanks,
Albert