1
0
mirror of https://github.com/djohnlewis/stackdump synced 2025-12-07 00:13:33 +00:00

Initial commit. Still building up the env and some parsing code.

This commit is contained in:
Samuel Lai
2011-09-11 14:29:39 +10:00
commit af2eafeccd
301 changed files with 82327 additions and 0 deletions

31
python/src/servers.py Normal file
View File

@@ -0,0 +1,31 @@
from bottle import ServerAdapter
import sys
class CherryPyServer(ServerAdapter):
'''
This copy of bottle's CherryPyServer is necessary so we can set the nodelay
option to false when running under Jython. Otherwise it will error out as
the TCP_NODELAY option is not supported with Jython.
'''
def run(self, handler): # pragma: no cover
from cherrypy import wsgiserver
server = wsgiserver.CherryPyWSGIServer((self.host, self.port), handler)
# Jython doesn't work with the TCP_NODELAY option
if sys.platform.startswith('java'):
server.nodelay = False
try:
server.start()
finally:
server.stop()
# in order for these to be specified in settings.py, they need to be in the
# following dictionary.
#
# if the name clashes with the default bottle ones, they definition here will
# be used instead.
definitions = {
'cherrypy' : CherryPyServer
}