[TransWarp] Infinite recursion computing a binded attribute
Oleg Broytmann
phd at work.phd.pp.ru
Tue May 20 09:49:44 EDT 2003
Hello! I've got a problem. Infinite recursion. I think I am doing something
wrong, but what?
Let me briefly describe my hierarchy of classes:
class Component(binding.Component):
appname = binding.bindTo("appname")
appver = binding.bindTo("appver")
log = binding.bindTo("log")
class Runnable(Component):
protocols.advise(instancesProvide=[Interfaces.IRunnable])
class ThreadRunnable(Runnable):
pass
class BaseHTTPD(Runnable):
protocols.advise(instancesProvide=[interfaces.IUiFrontend])
class HtmlServer(ThreadRunnable):
protocols.advise(instancesProvide=[interfaces.IUiServer])
class Application(binding.Component):
protocols.advise(instancesProvide=[Interfaces.IRunnable])
Components are loaded from config file:
[Provide Utilities]
ank.MedapE.interfaces.IUiFrontend = config.provideInstance('ank.MedapE.UiFrontEnd.BaseHTTPD.BaseHTTPD')
ank.MedapE.interfaces.IUiServer = config.provideInstance('ank.MedapE.UiServer.HtmlServer.HtmlServer')
[MedapE]
log = naming.lookup(targetObj, 'logfile:./MedapE.log?level=DEBUG')
components = "ui", "httpd"
component.ui = "ank.MedapE.UiServer.HtmlServer.HtmlServer"
component.httpd = "ank.MedapE.UiFrontend.BaseHTTPD.BaseHTTPD"
def run():
_root = config.makeRoot(iniFiles=(("peak", "peak.ini"), "MedapE.cfg"))
app = Application(parentComponent=_root)
app.start()
Boom!
STARTDIR=./ank/MedapE PEAK_CONFIG=`pwd`/MedapE.cfg PYTHONPATH=. python -t ./ank/MedapE/app.py
error: uncaptured python exception, closing channel <ank.MedapE.UiFrontend.BaseHTTPD.BaseHTTPDServer listening localhost:8084 at 0x869a534> (exceptions.RuntimeError:maximum recursion depth exceeded
[/usr/local/lib/python2.2/asyncore.py|poll3|183]
[/usr/local/lib/python2.2/asyncore.py|handle_read_event|390]
[BaseHTTPD.py|handle_accept|73]
[BaseHTTPD.py|__init__|42]
[/usr/local/lib/python2.2/SocketServer.py|__init__|514]
[/usr/local/lib/python2.2/BaseHTTPServer.py|handle|266]
[BaseHTTPD.py|process_request|47]
[BaseHTTPD.py|process_request|161]
[HtmlServer.py|handle|118]
There is just self.log.debug() in the line 118, but it seems peak cannot
compute self.log. Very strange, because in BaseHTTPD self.log was accessed
and used, no problems.
[C:\cygwin\home\pje\PEAK\src/peak/binding/_once.pyx|_once.OnceDescriptor.__get__|119]
[C:\cygwin\home\pje\PEAK\src/peak/binding/_once.pyx|_once.__get__|106]
[/usr/local/lib/python2.2/site-packages/peak/binding/components.py|computeValue|438]
[/usr/local/lib/python2.2/site-packages/peak/binding/components.py|lookupComponent|319]
[/usr/local/lib/python2.2/site-packages/peak/binding/components.py|lookup|399]
[/usr/local/lib/python2.2/site-packages/peak/binding/components.py|lookup|258]
[/usr/local/lib/python2.2/site-packages/peak/binding/components.py|acquireComponent|189]
[/usr/local/lib/python2.2/site-packages/peak/config/config_components.py|nameNotFound|407]
[/usr/local/lib/python2.2/site-packages/peak/naming/api.py|lookup|51]
[/usr/local/lib/python2.2/site-packages/peak/naming/contexts.py|__getitem__|355]
[/usr/local/lib/python2.2/site-packages/peak/naming/contexts.py|resolveToInterface|211]
[/usr/local/lib/python2.2/site-packages/peak/naming/contexts.py|_resolveComposite|103]
[/usr/local/lib/python2.2/site-packages/peak/naming/contexts.py|resolveToInterface|215]
[/usr/local/lib/python2.2/site-packages/peak/naming/contexts.py|_resolveLocal|173]
[/usr/local/lib/python2.2/site-packages/peak/naming/contexts.py|__getitem__|355]
[/usr/local/lib/python2.2/site-packages/peak/naming/contexts.py|resolveToInterface|215]
[/usr/local/lib/python2.2/site-packages/peak/naming/contexts.py|_resolveLocal|173]
[/usr/local/lib/python2.2/site-packages/peak/naming/contexts.py|__getitem__|355]
Infinite recursion... Ouch!
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru
Programmers don't die, they just GOSUB without RETURN.
More information about the PEAK
mailing list