[Twisted-Python] Woven Model extreme pain
James Y Knight
foom at fuhm.net
Thu Oct 2 11:36:06 EDT 2003
Okay, so I'm having a few issues with Models.
I have code that looks like follows (request.dbpool does in fact exist
in my code):
def getData(self, request):
return request.dbpool.runQuery("""select * from stuff""")
templateFile = "main.html"
isLeaf = 1
and, when i request in main.html the model be rendered like:
<span view="Text" model="/db" />
it gets apparently stuck in an infinite loop. getData keeps getting
called over and over. What am I doing wrong? If I return a Deferred
from wmfactory_db, it works fine, but not if I return one from getData.
My first thought was, maybe I should be using the "getter=" attr to the
initializer instead of overriding getData (and thus using a cache), but
when I tried that, my code was never called at all. It seems that the
cache is set to be initially valid, so the getter is never called!
And this is on top of my problems yesterday where I was trying to
return a Deferred from getSubmodel which excercises a code path that
never gets called otherwise which looks like it should handle the case
of a Deferred being returned but apparently has never been tested. I
was apparently supposed to override submodelFactory() instead of
getSubmodel, despite the fact that that isn't documented anywhere.
More information about the Twisted-Python