Closed twisted-trac closed 20 years ago
Automation removed owner |
---|
@jyknight commented |
---|
#!html
<pre>
I have code that looks like follows (request.dbpool does in fact exist in my code):
class DatabaseJunk(model.Model):
def getData(self, request):
return request.dbpool.runQuery("""select * from stuff""")
class Page(page.Page):
wmfactory_db(self, request):
return DatabaseJunk()
and, when i request in main.html the model be rendered like:
<span view="Text" model="/db" />
woven gets stuck in an infinite loop. This is happening because of the first 3 lines in
widgets.py setDataCallback. It calls setData and then getData when the deferred from the first call
to getData returns. However, getData always returns a Deferred and is unaffected by setData.
Thus, infinite loop.
Now, before you say my getData is buggy, I will refer you to the woven howto, section "7.3.4
IModel Adapters".
I 'fixed' this by commenting out those 3 lines and replacing them with "data = result".
I'd also like to point out there, that it shows how you can override setData to update the database.
Clearly this is a bad idea if the woven framework is going to calling setData behind the scenes.
</pre>
Searchable metadata
``` trac-id__317 317 type__defect defect reporter__jknight jknight priority__high high milestone__ branch__ branch_author__ status__closed closed resolution__fixed fixed component__ keywords__ time__1065480886000000 1065480886000000 changetime__1076053242000000 1076053242000000 version__ owner__ cc__dp cc__jknight ```