-
-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Runtime error when websocket is missing from environment
- Loading branch information
1 parent
1e0da30
commit 2ba8a89
Showing
2 changed files
with
16 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
import importlib | ||
import sys | ||
|
||
from eventlet.websocket import WebSocketWSGI as _WebSocketWSGI | ||
|
||
|
||
class WebSocketWSGI(_WebSocketWSGI): # pragma: no cover | ||
def __call__(self, environ, start_response): | ||
if 'eventlet.input' not in environ: | ||
raise RuntimeError('You need to use the eventlet server. ' | ||
'See the Deployment section of the ' | ||
'documentation for more information.') | ||
super(WebSocketWSGI, self).__call__(environ, start_response) | ||
|
||
|
||
async = { | ||
'threading': importlib.import_module('eventlet.green.threading'), | ||
'thread_class': 'Thread', | ||
'queue': importlib.import_module('eventlet.queue'), | ||
'queue_class': 'Queue', | ||
'websocket': importlib.import_module('eventlet.websocket'), | ||
'websocket': sys.modules[__name__], | ||
'websocket_class': 'WebSocketWSGI' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters