[Zope] calling DTMLFile from an External Method

Tim Lynch lynch@gould.mannlib.cornell.edu
Tue, 07 May 2002 8:07:24 EDT


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()

   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?


--
Tim Lynch                            tim.lynch@cornell.edu
Information Technology Section                607.255.9570
Albert R. Mann Library
Cornell University
Ithaca, NY 14853