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

Method call_on_close

src/werkzeug/wrappers/response.py:179–188  ·  view source on GitHub ↗

Adds a function to the internal list of functions that should be called as part of closing down the response. Since 0.7 this function also returns the function that was passed so that this can be used as a decorator. .. versionadded:: 0.6

(self, func: t.Callable[[], t.Any])

Source from the content-addressed store, hash-verified

177 self.response = response
178
179 def call_on_close(self, func: t.Callable[[], t.Any]) -> t.Callable[[], t.Any]:
180 """Adds a function to the internal list of functions that should
181 be called as part of closing down the response. Since 0.7 this
182 function also returns the function that was passed so that this
183 can be used as a decorator.
184
185 .. versionadded:: 0.6
186 """
187 self._on_close.append(func)
188 return func
189
190 def __repr__(self) -> str:
191 if self.is_sequence:

Callers 3

make_sequenceMethod · 0.95
test_base_responseFunction · 0.95
openMethod · 0.80

Calls 1

appendMethod · 0.80

Tested by 2

test_base_responseFunction · 0.76
openMethod · 0.64