_validate_key() — flask Function Reference
Architecture documentation for the _validate_key() function in cli.py from the flask codebase.
Entity Profile
Dependency Diagram
graph TD d30de8ad_c284_c49c_b6b6_50333e67918c["_validate_key()"] a96499c3_f8a9_e782_f156_1c1ee4a86c69["cli.py"] d30de8ad_c284_c49c_b6b6_50333e67918c -->|defined in| a96499c3_f8a9_e782_f156_1c1ee4a86c69 style d30de8ad_c284_c49c_b6b6_50333e67918c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/flask/cli.py lines 828–864
def _validate_key(ctx: click.Context, param: click.Parameter, value: t.Any) -> t.Any:
"""The ``--key`` option must be specified when ``--cert`` is a file.
Modifies the ``cert`` param to be a ``(cert, key)`` pair if needed.
"""
cert = ctx.params.get("cert")
is_adhoc = cert == "adhoc"
try:
import ssl
except ImportError:
is_context = False
else:
is_context = isinstance(cert, ssl.SSLContext)
if value is not None:
if is_adhoc:
raise click.BadParameter(
'When "--cert" is "adhoc", "--key" is not used.', ctx, param
)
if is_context:
raise click.BadParameter(
'When "--cert" is an SSLContext object, "--key" is not used.',
ctx,
param,
)
if not cert:
raise click.BadParameter('"--cert" must also be specified.', ctx, param)
ctx.params["cert"] = cert, value
else:
if cert and not (is_adhoc or is_context):
raise click.BadParameter('Required when using "--cert".', ctx, param)
return value
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does _validate_key() do?
_validate_key() is a function in the flask codebase, defined in src/flask/cli.py.
Where is _validate_key() defined?
_validate_key() is defined in src/flask/cli.py at line 828.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free