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:
31
python/src/servers.py
Normal file
31
python/src/servers.py
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user