Skip to content

Commit

Permalink
Raise RuntimeError when using gevent without monkey-patches.
Browse files Browse the repository at this point in the history
  • Loading branch information
defnull committed Aug 29, 2012
1 parent 14020ae commit 2b1ed4f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bottle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 2b1ed4f

Please sign in to comment.