[PEAK] Problem with ZopePageTemplates
William Trenker
wtrenker at shaw.ca
Sun Dec 7 07:54:24 EST 2003
First, being new here, I'm not sure if I should ask for help on examples from the Wiki on this mailing list, or if I should add a comment to the relevant Wiki page. If I shouldn't be addressing this question here let me know and please accept my apologies.)
I've been exploring Zope X3 (Milestone 4) on my Linux system so when I saw the ZopePageTemplates page on the DevCenter Wiki I thought I'd give it a try. Unfortunately I'm getting a lengthy traceback (gory details at the end of this post) which boils down to "NameError: name 'IWebMethod' is not defined".
Just to be sure my http server's cgi-bin works, I installed the trivial_web example from the PEAK distribution. That works fine. To install the ZopePageTemplate example I set up my cgi-bin as follows:
/home/cgi-bin/
|----zpttest.cgi/
|----zpt/
|---zpttest.py
|---index.zpt
the file /home/cgi-bin/zpttest.cgi is chmod'ed as +x and contains:
#!/bin/sh -login
# Edit the next line to reflect the location of the trivial_cgi directory
export PYTHONPATH=./zpt
exec peak CGI import:zpttest.ZPTTestApp
I realize that using Zope X3 with PEAK is probably a bit shaky right now and from the notes I've read on the PEAK site the existance of Zope on a system can effect how PEAK is installed on that system. For reference here's my Zope X3 info:
>>> import zope
>>> print zope.__file__
/usr/local/lib/python2.3/site-packages/zope/__init__.pyc
>>> import zope.app.applicationcontrol.zopeversion as zv
>>> zv.ZopeVersionUtility.getZopeVersion()
'Zope X3 Pre-M4'
When I test the zpttest.cgi script at the command prompt I get the following traceback:
/home/cgi-bin# ./zpttest.cgi
Traceback (most recent call last):
File "/usr/local/bin/peak", line 4, in ?
commands.runMain( commands.Bootstrap )
File "/usr/local/lib/python2.3/site-packages/peak/running/commands.py", line 70, in runMain
result = factory().run()
File "/usr/local/lib/python2.3/site-packages/peak/running/commands.py", line 98, in <lambda>
factory = lambda: ob(config.makeRoot())
File "/usr/local/lib/python2.3/site-packages/peak/running/commands.py", line 303, in __call__
return cmd.interpret(cmd.argv[1])
File "/usr/local/lib/python2.3/site-packages/peak/running/commands.py", line 627, in interpret
return self.getSubcommand(factory)
File "/usr/local/lib/python2.3/site-packages/peak/running/commands.py", line 271, in getSubcommand
return super(AbstractInterpreter,self).getSubcommand(executable, **kw)
File "/usr/local/lib/python2.3/site-packages/peak/running/commands.py", line 183, in getSubcommand
return factory(**kw)
File "/usr/local/lib/python2.3/site-packages/peak/binding/components.py", line 726, in __init__
self.setParentComponent(parentComponent,componentName)
File "/usr/local/lib/python2.3/site-packages/peak/binding/components.py", line 766, in setParentComponent
self.__parentComponent # lock and invoke assembly events
File "C:\cygwin\home\pje\PEAK\src/peak/binding/_once.pyx", line 112, in _once.BaseDescriptor.__get__
File "C:\cygwin\home\pje\PEAK\src/peak/binding/_once.pyx", line 100, in _once.__get__
File "/usr/local/lib/python2.3/site-packages/peak/binding/components.py", line 791, in __parentComponent
notifyUponAssembly(parent,self)
File "/usr/local/lib/python2.3/site-packages/peak/binding/components.py", line 197, in notifyUponAssembly
nua(child)
File "/usr/local/lib/python2.3/site-packages/peak/binding/components.py", line 857, in notifyUponAssembly
notifyUponAssembly(self.getParentComponent(),self)
File "/usr/local/lib/python2.3/site-packages/peak/binding/components.py", line 197, in notifyUponAssembly
nua(child)
File "/usr/local/lib/python2.3/site-packages/peak/binding/components.py", line 848, in notifyUponAssembly
child.uponAssembly() # assembly has already occurred
File "/usr/local/lib/python2.3/site-packages/peak/binding/components.py", line 875, in uponAssembly
ob.uponAssembly()
File "/usr/local/lib/python2.3/site-packages/peak/binding/components.py", line 881, in uponAssembly
getattr(self,attr)
File "C:\cygwin\home\pje\PEAK\src/peak/binding/_once.pyx", line 112, in _once.BaseDescriptor.__get__
File "C:\cygwin\home\pje\PEAK\src/peak/binding/_once.pyx", line 100, in _once.__get__
File "/usr/local/lib/python2.3/site-packages/peak/binding/once.py", line 498, in <lambda>
f = lambda s,d,a: func(s)
File "/usr/local/lib/python2.3/site-packages/peak/running/commands.py", line 960, in __setupCGI
self.reactor.callLater(
File "C:\cygwin\home\pje\PEAK\src/peak/binding/_once.pyx", line 112, in _once.BaseDescriptor.__get__
File "C:\cygwin\home\pje\PEAK\src/peak/binding/_once.pyx", line 100, in _once.__get__
File "/usr/local/lib/python2.3/site-packages/peak/binding/once.py", line 498, in <lambda>
f = lambda s,d,a: func(s)
File "/usr/local/lib/python2.3/site-packages/peak/running/commands.py", line 999, in cgiCommand
ob = self.lookupComponent(name, suggestParent=False, default=NOT_FOUND)
File "/usr/local/lib/python2.3/site-packages/peak/binding/components.py", line 356, in lookupComponent
result = adapt(name, IComponentKey).findComponent( component, default )
File "/usr/local/lib/python2.3/site-packages/peak/naming/names.py", line 198, in findComponent
return lookup(
File "/usr/local/lib/python2.3/site-packages/peak/naming/api.py", line 53, in lookup
return InitialContext(parent, **options).lookup(name,default)
File "/usr/local/lib/python2.3/site-packages/peak/naming/contexts.py", line 400, in lookup
return self.get(name,default)
File "/usr/local/lib/python2.3/site-packages/peak/naming/contexts.py", line 375, in get
if ctx is not self: return ctx.get(name,default)
File "/usr/local/lib/python2.3/site-packages/peak/naming/contexts.py", line 377, in get
return self._getOb(name, default)
File "/usr/local/lib/python2.3/site-packages/peak/naming/contexts.py", line 442, in _getOb
state = self._get(name)
File "/usr/local/lib/python2.3/site-packages/peak/naming/factories/peak_imports.py", line 18, in _get
return importString(name.body)
File "/usr/local/lib/python2.3/site-packages/peak/util/imports.py", line 79, in importString
item = __import__('.'.join(path), globalDict, globalDict, ['__name__'])
File "/home/cgi-bin/zpt/zpttest.py", line 9, in ?
class PageTemplateAsWebMethod(protocols.Adapter):
File "/home/cgi-bin/zpt/zpttest.py", line 13, in PageTemplateAsWebMethod
protocols.advise(
NameError: name 'IWebMethod' is not defined
I'm not sure where to go from here.
Thanks for helping,
Bill
More information about the PEAK
mailing list