MCPcopy
hub / github.com/pallets/flask / copy

Method copy

src/flask/ctx.py:337–355  ·  view source on GitHub ↗

Creates a copy of this request context with the same request object. This can be used to move a request context to a different greenlet. Because the actual request object is the same this cannot be used to move a request context to a different thread unless access to the

(self)

Source from the content-addressed store, hash-verified

335 ] = []
336
337 def copy(self) -> RequestContext:
338 """Creates a copy of this request context with the same request object.
339 This can be used to move a request context to a different greenlet.
340 Because the actual request object is the same this cannot be used to
341 move a request context to a different thread unless access to the
342 request object is locked.
343
344 .. versionadded:: 0.10
345
346 .. versionchanged:: 1.1
347 The current session object is used instead of reloading the original
348 data. This prevents `flask.session` pointing to an out-of-date object.
349 """
350 return self.__class__(
351 self.app,
352 environ=self.request.environ,
353 request=self.request,
354 session=self._session,
355 )
356
357 def match_request(self) -> None:
358 """Can be overridden by a subclass to hook into the matching

Callers 4

registerMethod · 0.80
indexMethod · 0.80

Calls

no outgoing calls

Tested by 1

indexMethod · 0.64