Home / Function/ copy() — flask Function Reference

copy() — flask Function Reference

Architecture documentation for the copy() function in ctx.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  b9619729_0242_23b5_d6f7_5f78607ae976["copy()"]
  86817dcd_97b5_9a9f_aee8_5fa78b4cecc9["AppContext"]
  b9619729_0242_23b5_d6f7_5f78607ae976 -->|defined in| 86817dcd_97b5_9a9f_aee8_5fa78b4cecc9
  8c4a599b_81bd_7179_af9c_5ae61d56dc9d["update_template_context()"]
  8c4a599b_81bd_7179_af9c_5ae61d56dc9d -->|calls| b9619729_0242_23b5_d6f7_5f78607ae976
  f7f0b202_038e_4088_d0b8_b9f6511ffba0["copy_current_request_context()"]
  f7f0b202_038e_4088_d0b8_b9f6511ffba0 -->|calls| b9619729_0242_23b5_d6f7_5f78607ae976
  style b9619729_0242_23b5_d6f7_5f78607ae976 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/ctx.py lines 354–367

    def copy(self) -> te.Self:
        """Create a new context with the same data objects as this context. See
        :func:`.copy_current_request_context`.

        .. versionchanged:: 1.1
            The current session data is used instead of reloading the original data.

        .. versionadded:: 0.10
        """
        return self.__class__(
            self.app,
            request=self._request,
            session=self._session,
        )

Subdomains

Defined In

Frequently Asked Questions

What does copy() do?
copy() is a function in the flask codebase, defined in src/flask/ctx.py.
Where is copy() defined?
copy() is defined in src/flask/ctx.py at line 354.
What calls copy()?
copy() is called by 2 function(s): copy_current_request_context, update_template_context.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free