[Twisted-web] Should an error hang the server?
Greg Lappen
twisted-web@twistedmatrix.com
Mon, 15 Dec 2003 18:46:15 -0500
I didn't think so, but that's what's happening. Sorry for the lack of
info in my previous post.
I still see requests from my browser in the log file, but never get a
response.
Am I setting up the server incorrectly maybe? This is on Mac OS X, is
that maybe a factor?
Here's my .tac file:
------------------------
TriviaServer.tac---------------------------------
from twisted.internet.protocol import Factory
from twisted.application import service, internet
from twisted.persisted import sob
from twisted.web import server
from Trivia import TriviaProtocol, TriviaGame
import webui
import sys
factory = Factory()
factory.protocol = TriviaProtocol
factory.game = TriviaGame('classictv')
application = service.Application("TriviaServer-" + sys.argv[1])
sc = service.IServiceCollection(application)
internet.TCPServer(5678, factory).setServiceParent(sc)
# Test web stuff
root = webui.Root()
site = server.Site(root)
internet.TCPServer(8888, site).setServiceParent(sc)
---------------------------------------------------
Here's my webui module:
------------------webui.py---------------------
from twisted.web.woven import page
from twisted.web.woven import widgets
class Conditional(widgets.Widget):
def __init__(self, boolean):
widgets.Widget.__init__(self)
self.boolean=boolean
def setUp(self, request, node, data):
if self.boolean:
removedNode = self.getPattern("False", clone=False)
else:
removedNode = self.getPattern("True", clone=False)
print ('removedNode:' + removedNode.toxml())
node.removeChild(removedNode)
class Root(page.Page):
templateFile="root.html"
def wmfactory_stuff(self, request):
return ['one', 'two', 'three']
def wmfactory_letters(self, request):
word = request.args['name'][0]
return word
def wvfactory_nameLongEnough(self, request, node, model):
name = request.args['name'][0]
return Conditional(len(name) > 5)
--------------------------------------------
Greg
On Dec 15, 2003, at 6:23 PM, Donovan Preston wrote:
>
> On Dec 15, 2003, at 5:50 PM, Greg Lappen wrote:
>
>> I am playing with some twisted-web and woven stuff.
>>
>> I noticed that whenever I get an error page, the server no longer
>> handles requests.
>>
>> Is this the intended behavior?
>
> No. An exception should not hang the server.
>
> dp
>
>
> _______________________________________________
> Twisted-web mailing list
> Twisted-web@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
>