forked from orbit-oss/flask
Ensure that blueprint subdomains suffix-chain
This ensures that a child's subdomain prefixs any parent subdomain such that the full domain is child.parent.domain.tld and onwards with further nesting. This makes the most sense to users and mimics how url_prefixes work (although subdomains suffix).
This commit is contained in:
parent
d7b6c1f670
commit
cabda59353
4 changed files with 26 additions and 4 deletions
|
|
@ -358,6 +358,9 @@ class Blueprint(Scaffold):
|
|||
:param options: Keyword arguments forwarded from
|
||||
:meth:`~Flask.register_blueprint`.
|
||||
|
||||
.. versionchanged:: 2.3
|
||||
Nested blueprints now correctly apply subdomains.
|
||||
|
||||
.. versionchanged:: 2.0.1
|
||||
Nested blueprints are registered with their dotted name.
|
||||
This allows different blueprints with the same name to be
|
||||
|
|
@ -458,10 +461,12 @@ class Blueprint(Scaffold):
|
|||
if bp_subdomain is None:
|
||||
bp_subdomain = blueprint.subdomain
|
||||
|
||||
if state.subdomain is not None and bp_subdomain is None:
|
||||
bp_options["subdomain"] = state.subdomain
|
||||
if state.subdomain is not None and bp_subdomain is not None:
|
||||
bp_options["subdomain"] = bp_subdomain + "." + state.subdomain
|
||||
elif bp_subdomain is not None:
|
||||
bp_options["subdomain"] = bp_subdomain
|
||||
elif state.subdomain is not None:
|
||||
bp_options["subdomain"] = state.subdomain
|
||||
|
||||
if bp_url_prefix is None:
|
||||
bp_url_prefix = blueprint.url_prefix
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue