From 4d3a563435379df498e6310103bf8cfef324ea92 Mon Sep 17 00:00:00 2001 From: Jonas Haag Date: Mon, 9 Aug 2010 19:01:22 +0800 Subject: Workaround for fapws3's broken API --- bottle.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bottle.py b/bottle.py index dc478e7..c50552e 100755 --- a/bottle.py +++ b/bottle.py @@ -1372,9 +1372,12 @@ class FapwsServer(ServerAdapter): """ def run(self, handler): # pragma: no cover import fapws._evwsgi as evwsgi - from fapws import base - # If this segfaults, your fapws3 is to old. See #85 - evwsgi.start(self.host, str(self.port)) + from fapws import base, config + port = self.port + if float(config.SERVER_IDENT[-2:]) > 0.4: + # fapws3 silently changed its API in 0.5 + port = str(port) + evwsgi.start(self.host, port) # fapws3 never releases the GIL. Complain upstream. I tried. No luck. if 'BOTTLE_CHILD' in os.environ and not self.quiet: print "WARNING: Auto-reloading does not work with Fapws3." @@ -1383,7 +1386,7 @@ class FapwsServer(ServerAdapter): def app(environ, start_response): environ['wsgi.multiprocess'] = False return handler(environ, start_response) - evwsgi.wsgi_cb(('',app)) + evwsgi.wsgi_cb(('', app)) evwsgi.run() -- cgit v1.2.1