@@ -260,7 +260,7 @@ def register(self, app: "Flask", options: dict) -> None:
260
260
"""Called by :meth:`Flask.register_blueprint` to register all
261
261
views and callbacks registered on the blueprint with the
262
262
application. Creates a :class:`.BlueprintSetupState` and calls
263
- each :meth:`record` callbackwith it.
263
+ each :meth:`record` callback with it.
264
264
265
265
:param app: The application this blueprint is being registered
266
266
with.
@@ -344,13 +344,17 @@ def extend(bp_dict, parent_dict):
344
344
app .cli .add_command (self .cli )
345
345
346
346
for blueprint , bp_options in self ._blueprints :
347
- url_prefix = options .get ("url_prefix" , "" )
348
- if "url_prefix" in bp_options :
349
- url_prefix = (
350
- url_prefix .rstrip ("/" ) + "/" + bp_options ["url_prefix" ].lstrip ("/" )
347
+ bp_options = bp_options .copy ()
348
+ bp_url_prefix = bp_options .get ("url_prefix" )
349
+
350
+ if bp_url_prefix is None :
351
+ bp_url_prefix = blueprint .url_prefix
352
+
353
+ if state .url_prefix is not None and bp_url_prefix is not None :
354
+ bp_options ["url_prefix" ] = (
355
+ state .url_prefix .rstrip ("/" ) + "/" + bp_url_prefix .lstrip ("/" )
351
356
)
352
357
353
- bp_options ["url_prefix" ] = url_prefix
354
358
bp_options ["name_prefix" ] = options .get ("name_prefix" , "" ) + self .name + "."
355
359
blueprint .register (app , bp_options )
356
360
0 commit comments