wmfactory not consistently executed
Hello, I'm new to woven, but my understanding from the documentation is that the appropriate model factories are executed for every request/response. By watching the twistd.log for a print statement in my wmfactory, it seems that the wmfactory method is not executed for every request/response. The appearance (or lack thereof) of my printed statement in the log seems to be unrelated to the frequency of requests. ## test.py import os from twisted.application import service, internet from twisted.web.woven import page from twisted.web import server class MainPage(page.Page): template = """ <html> <body> <div model="test"/> </body> </html> """ def wmfactory_test(self, request): print "in test wmfactory" return "hey" site = server.Site(MainPage()) application = service.Application("test") parent = service.IServiceCollection(application) internet.TCPServer(8088, site).setServiceParent(parent) ## Can anyone tell me if I'm doing something wrong or if my understanding of wmfactories is incorrect? Thanks, Dean __________________________________ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus
Dean Skuldt [Sat, Jan 10, 2004 at 08:47:42AM -0800]:
I'm new to woven, but my understanding from the documentation is that the appropriate model factories are executed for every request/response. By watching the twistd.log for a print statement in my wmfactory, it seems that the wmfactory method is not executed for every request/response.
Perhaps you could use View -- change:
<div model="test"/>
to: <div model="test" view="Text" />
Thanks for your quick response. I tried it out, and I'm observing the same behaviour. Hmmmmm. --- Michal Pasternak <michal@pasternak.w.lub.pl> wrote:
I'm new to woven, but my understanding from the documentation is that the appropriate model factories are executed for every request/response. By watching the twistd.log for a print statement in my wmfactory, it seems
Dean Skuldt [Sat, Jan 10, 2004 at 08:47:42AM -0800]: that
the wmfactory method is not executed for every request/response.
Perhaps you could use View -- change:
<div model="test"/>
to:
<div model="test" view="Text" />
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
__________________________________ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus
Dean Skuldt [Sat, Jan 10, 2004 at 09:07:43AM -0800]:
Thanks for your quick response. I tried it out, and I'm observing the same behaviour. Hmmmmm.
How are you running that script? On my machine (Twisted 1.1.1, Python 2.3) when run with twistd -noy test.py works just okay. Perhaps the reason you're not getting expected behaviour is your fault (eg. you're running wrong script).
I'm using twistd -y test.py It's the correct script - thanks for checking that. --- Michal Pasternak <michal@pasternak.w.lub.pl> wrote:
Dean Skuldt [Sat, Jan 10, 2004 at 09:07:43AM -0800]:
Thanks for your quick response. I tried it out, and I'm observing the same behaviour. Hmmmmm.
How are you running that script? On my machine (Twisted 1.1.1, Python 2.3) when run with twistd -noy test.py works just okay. Perhaps the reason you're not getting expected behaviour is your fault (eg. you're running wrong script).
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
__________________________________ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus
It takes several tries for the error to occur. Most often, the wmfactory method is executed, but once in a while it fails. When I test it, I issue requests in a browser about once a second. The following shows three successes followed by one failure: 2004/01/10 12:29 PST [HTTPChannel,0,127.0.0.1] in test wmfactory 2004/01/10 12:29 PST [HTTPChannel,0,127.0.0.1] 127.0.0.1 - - [10/Jan/2004:20:29:19 +0000] "POST / HTTP/1.1" 200 74 "http://127.0.0.1:8088/" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204" 2004/01/10 12:29 PST [HTTPChannel,0,127.0.0.1] in test wmfactory 2004/01/10 12:29 PST [HTTPChannel,0,127.0.0.1] 127.0.0.1 - - [10/Jan/2004:20:29:20 +0000] "POST / HTTP/1.1" 200 74 "http://127.0.0.1:8088/" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204" 2004/01/10 12:29 PST [HTTPChannel,0,127.0.0.1] in test wmfactory 2004/01/10 12:29 PST [HTTPChannel,0,127.0.0.1] 127.0.0.1 - - [10/Jan/2004:20:29:21 +0000] "POST / HTTP/1.1" 200 74 "http://127.0.0.1:8088/" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204" 2004/01/10 12:29 PST [HTTPChannel,0,127.0.0.1] 127.0.0.1 - - [10/Jan/2004:20:29:23 +0000] "POST / HTTP/1.1" 200 74 "http://127.0.0.1:8088/" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204" I should also note that I wrote this test script to hone in on the problem. In my original script I also used a wvupdate method which DID consistently execute for every request/response, but as with the test script the wmfactory method didn't consistently execute. Has anyone experienced this? Thanks, Dean --- Dean Skuldt <deanskuldt@yahoo.com> wrote:
I'm using twistd -y test.py It's the correct script - thanks for checking that. --- Michal Pasternak <michal@pasternak.w.lub.pl> wrote:
Dean Skuldt [Sat, Jan 10, 2004 at 09:07:43AM -0800]:
Thanks for your quick response. I tried it out, and I'm observing the same behaviour. Hmmmmm.
How are you running that script? On my machine (Twisted 1.1.1, Python 2.3) when run with twistd -noy test.py works just okay. Perhaps the reason you're not getting expected behaviour is your fault (eg. you're running wrong script).
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
__________________________________ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
__________________________________ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus
On Jan 10, 2004, at 1:37 PM, Dean Skuldt wrote:
It takes several tries for the error to occur. Most often, the wmfactory method is executed, but once in a while it fails. When I test it, I issue requests in a browser about once a second. The following shows three successes followed by one failure:
I should also note that I wrote this test script to hone in on the problem. In my original script I also used a wvupdate method which DID consistently execute for every request/response, but as with the test script the wmfactory method didn't consistently execute.
Has anyone experienced this?
I had all sorts of weird problems with the data caching in woven. I did try some workarounds, but never found oneĀ I was happy with and that worked quite properly. I don't recall ever seeing the problem with wmfactory_ methods (just custom data objects), but I wouldn't be all that surprised. I've now moved to nevow, which doesn't cache data behind the scenes and thus doesn't have these problems.
participants (3)
-
Dean Skuldt
-
James Y Knight
-
Michal Pasternak