diff options
author | Marcel Hellkamp <marc@gsites.de> | 2012-08-30 01:58:15 +0200 |
---|---|---|
committer | Marcel Hellkamp <marc@gsites.de> | 2012-08-30 01:58:15 +0200 |
commit | 2b1ed4f746c28a55c497ff482c9f50d9480bc40f (patch) | |
tree | d19375e2e51293641c1ee802609524922c9162bb | |
parent | 14020ae680d8309c331f961f52e7b64e35c66d1b (diff) | |
download | bottle-2b1ed4f746c28a55c497ff482c9f50d9480bc40f.tar.gz |
Raise RuntimeError when using gevent without monkey-patches.
-rw-r--r-- | bottle.py | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -2488,10 +2488,11 @@ class GeventServer(ServerAdapter): issues: No streaming, no pipelining, no SSL. """ def run(self, handler): - from gevent import wsgi as wsgi_fast, pywsgi, monkey, local - if self.options.get('monkey', True): - if not threading.local is local.local: monkey.patch_all() - wsgi = wsgi_fast if self.options.get('fast') else pywsgi + from gevent import wsgi, pywsgi, local + if not isinstance(_lctx, local.local): + msg = "Bottle requires gevent.monkey.patch_all() (before import)" + raise RuntimeError(msg) + if not self.options.get('fast'): wsgi = pywsgi log = None if self.quiet else 'default' wsgi.WSGIServer((self.host, self.port), handler, log=log).serve_forever() |