Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update wsgi.py #166

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ryu/app/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class _AlreadyHandledResponse(Response):
import eventlet
if version.parse(eventlet.__version__) >= version.parse("0.30.3"):
import eventlet.wsgi
_ALREADY_HANDLED = getattr(eventlet.wsgi, "ALREADY_HANDLED", None)
_ALREADY_HANDLED = getattr(getattr(eventlet.wsgi, "WSGI_LOCAL", None), "already_handled", None)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should instead take a similar approach than the fix pushed in gunicorn project here. Here is an example:

EVENTLET_WSGI_LOCAL = getattr(eventlet.wsgi, "WSGI_LOCAL", None)
EVENTLET_ALREADY_HANDLED = getattr(eventlet.wsgi, "ALREADY_HANDLED", None)
...
if getattr(EVENTLET_WSGI_LOCAL, "already_handled", None):
    _ALREADY_HANDLED = getattr(EVENTLET_WSGI_LOCAL, "already_handled", False)
else:
    _ALREADY_HANDLED = EVENTLET_ALREADY_HANDLED

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your comment help a lot, thank you👍

else:
from eventlet.wsgi import ALREADY_HANDLED
_ALREADY_HANDLED = ALREADY_HANDLED
Expand Down