[Zope] calling DTMLFile from an External Method

hans hans@beehive.de
Tue, 07 May 2002 14:29:22 +0100


Tim Lynch wrote:

> How do I make use of DTMLFile from an External Method?
>
> No matter what I try, I can't get it to work.  I think I'm
> now close, but can't get past this latest problem:
>
> Here's my External Method:
>
> ----
> from Globals import InitializeClass, DTMLFile, package_home
> from Acquisition import Implicit
> from Globals import Persistent
> from DocumentTemplate import HTML
>
> def tst1():
>
>    stuff = DTMLFile('Extensions/sample', globals())
>    results = stuff()
>

results = self.stuff( REQUEST )


>
>    return results
>
> ----
> Here's the snippet of a DTML Method that invokes it:
>
> <dtml-let ans="tst1()">
> <dtml-var ans><br>
> </dtml-let>
>
> ----
> But when I 'View' or otherwise invoke the DTML Method, I get
>
> Error Type: KeyError
> Error Value:  __name__
>
> I've looked back through the archives, but can't find an
> answer to this problem.
>
> What's wrong with my External Method and what do I need to
> add to get the DTMLFile call to work?