MCPcopy
hub / github.com/pallets/werkzeug / __call__

Method __call__

src/werkzeug/middleware/dispatcher.py:62–81  ·  view source on GitHub ↗
(
        self, environ: WSGIEnvironment, start_response: StartResponse
    )

Source from the content-addressed store, hash-verified

60 self.mounts = mounts or {}
61
62 def __call__(
63 self, environ: WSGIEnvironment, start_response: StartResponse
64 ) -> t.Iterable[bytes]:
65 script = environ.get("PATH_INFO", "")
66 path_info = ""
67
68 while "/" in script:
69 if script in self.mounts:
70 app = self.mounts[script]
71 break
72
73 script, last_item = script.rsplit("/", 1)
74 path_info = f"/{last_item}{path_info}"
75 else:
76 app = self.mounts.get(script, self.app)
77
78 original_script_name = environ.get("SCRIPT_NAME", "")
79 environ["SCRIPT_NAME"] = original_script_name + script
80 environ["PATH_INFO"] = path_info
81 return app(environ, start_response)

Callers

nothing calls this directly

Calls 2

appFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected