views.py — flask Source File
Architecture documentation for views.py, a python file in the flask codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 25d123dc_627c_928a_300c_360bcb8e17f5["views.py"] 949a3336_caad_34e4_9d3f_a6e1653188ba["949a3336:caad:34e4:9d3f:a6e1653188ba"] 25d123dc_627c_928a_300c_360bcb8e17f5 --> 949a3336_caad_34e4_9d3f_a6e1653188ba 9cff5a62_7dbb_7b80_cf3c_128a7a2fda28["globals.py"] 25d123dc_627c_928a_300c_360bcb8e17f5 --> 9cff5a62_7dbb_7b80_cf3c_128a7a2fda28 d3e9218c_bf0a_48f5_15c9_90795af6f3ac["typing.py"] 25d123dc_627c_928a_300c_360bcb8e17f5 --> d3e9218c_bf0a_48f5_15c9_90795af6f3ac style 25d123dc_627c_928a_300c_360bcb8e17f5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from __future__ import annotations
import typing as t
from . import typing as ft
from .globals import current_app
from .globals import request
F = t.TypeVar("F", bound=t.Callable[..., t.Any])
http_method_funcs = frozenset(
["get", "post", "head", "options", "delete", "put", "trace", "patch"]
)
class View:
"""Subclass this class and override :meth:`dispatch_request` to
create a generic class-based view. Call :meth:`as_view` to create a
view function that creates an instance of the class with the given
arguments and calls its ``dispatch_request`` method with any URL
variables.
See :doc:`views` for a detailed guide.
.. code-block:: python
class Hello(View):
init_every_request = False
def dispatch_request(self, name):
return f"Hello, {name}!"
app.add_url_rule(
"/hello/<name>", view_func=Hello.as_view("hello")
)
Set :attr:`methods` on the class to change what methods the view
accepts.
Set :attr:`decorators` on the class to apply a list of decorators to
the generated view function. Decorators applied to the class itself
will not be applied to the generated view function!
Set :attr:`init_every_request` to ``False`` for efficiency, unless
you need to store request-global data on ``self``.
"""
#: The methods this view is registered for. Uses the same default
#: (``["GET", "HEAD", "OPTIONS"]``) as ``route`` and
#: ``add_url_rule`` by default.
methods: t.ClassVar[t.Collection[str] | None] = None
#: Control whether the ``OPTIONS`` method is handled automatically.
#: Uses the same default (``True``) as ``route`` and
#: ``add_url_rule`` by default.
provide_automatic_options: t.ClassVar[bool | None] = None
#: A list of decorators to apply, in order, to the generated view
#: function. Remember that ``@decorator`` syntax is applied bottom
#: to top, so the first decorator in the list would be the bottom
// ... (132 more lines)
Domain
Subdomains
Classes
Dependencies
- 949a3336:caad:34e4:9d3f:a6e1653188ba
- globals.py
- typing.py
Source
Frequently Asked Questions
What does views.py do?
views.py is a source file in the flask codebase, written in python. It belongs to the ApplicationCore domain, Scaffolding subdomain.
What does views.py depend on?
views.py imports 3 module(s): 949a3336:caad:34e4:9d3f:a6e1653188ba, globals.py, typing.py.
Where is views.py in the architecture?
views.py is located at src/flask/views.py (domain: ApplicationCore, subdomain: Scaffolding, directory: src/flask).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free