[Zope-dev] Calling Python method from subclassed ZClass DTML method ?
Brad Clements
bkc@murkworks.com
Mon, 8 Nov 1999 18:02:46 -0500
I've created a simple Custom Python Class as described in the ZClass
Tutorial, but I can't seem to call a python class method from a DHTML
method in my derived ZClass.
My Python module gets registered correctly.
I went to Control Panel/ Products and saw my Package listed "Mercury".
Under Mercury, I chose to create a new ZClass called Stats, which is
subclassed from ModuleFactory, a class I registered in my Package's
__init__.py
Zope\Lib\Python\products\Mercury\__init__.py has
import MercuryJobs
import MercuryStats
def initialize(context):
"""Called by Zope to initialize a product"""
context.registerBaseClass(MercuryJobs.QueueManager)
context.registerBaseClass(MercuryStats.ModuleFactory)
----
In the Zclass 'stat's, I added a new DTML method called getModules,
and that method has:
<dtml-var ModuleList>
When I choose to view it, I get KeyError, ModuleList.
Perhaps this can't be viewed until instantiated? Am I on the right track?
MercuryStats.ModuleFactory returns a list of objects which I'll want to
iterate over with #in. I'm expecting to add a "Mercury/Stats" object into
a folder at some point, then #in on it to get the list of objects.
Is this the correct way to call a method in a python base class from a
DHTML method in Zclass?
Brad Clements, bkc@murkworks.com (315)268-1000
http://www.murkworks.com (315)268-9812 Fax
netmeeting: ils://ils.murkworks.com ICQ: 14856937