summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Haag <jonas@lophus.org>2010-08-09 19:01:22 +0800
committerMarcel Hellkamp <marc@gsites.de>2010-08-09 20:36:07 +0800
commit4d3a563435379df498e6310103bf8cfef324ea92 (patch)
tree95462537250529855a86d1f126a985ca353b472c
parent4bdb2f1c550e49a843ae45689f488579a5cf365a (diff)
downloadbottle-4d3a563435379df498e6310103bf8cfef324ea92.tar.gz
Workaround for fapws3's broken API
-rwxr-xr-xbottle.py11
1 files 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()