Skip to content

Commit 46bdf8c

Browse files
authored
WSGIContainer.environ changed (#971)
Specifically it changed from a staticmethod to an instance one. This happened in Tornado 6.3. See: tornadoweb/tornado#3231 (comment)
1 parent 849df98 commit 46bdf8c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/reactpy/backend/tornado.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ async def recv() -> Any:
196196
ConnectionContext(
197197
self._component_constructor(),
198198
value=Connection(
199-
scope=WSGIContainer.environ(self.request),
199+
scope=_FAKE_WSGI_CONTAINER.environ(self.request),
200200
location=Location(
201201
pathname=f"/{path[len(self._url_prefix):]}",
202202
search=(
@@ -222,3 +222,10 @@ async def on_message(self, message: str | bytes) -> None:
222222
def on_close(self) -> None:
223223
if not self._dispatch_future.done():
224224
self._dispatch_future.cancel()
225+
226+
227+
# The interface for WSGIContainer.environ changed in Tornado version 6.3 from
228+
# a staticmethod to an instance method. Since we're not that concerned with
229+
# the details of the WSGI app itself, we can just use a fake one.
230+
# see: https://github.com/tornadoweb/tornado/pull/3231#issuecomment-1518957578
231+
_FAKE_WSGI_CONTAINER = WSGIContainer(lambda *a, **kw: iter([]))

0 commit comments

Comments
 (0)