| 39 | """ |
| 40 | |
| 41 | def __init__( |
| 42 | self, |
| 43 | blueprint: Blueprint, |
| 44 | app: App, |
| 45 | options: t.Any, |
| 46 | first_registration: bool, |
| 47 | ) -> None: |
| 48 | #: a reference to the current application |
| 49 | self.app = app |
| 50 | |
| 51 | #: a reference to the blueprint that created this setup state. |
| 52 | self.blueprint = blueprint |
| 53 | |
| 54 | #: a dictionary with all options that were passed to the |
| 55 | #: :meth:`~flask.Flask.register_blueprint` method. |
| 56 | self.options = options |
| 57 | |
| 58 | #: as blueprints can be registered multiple times with the |
| 59 | #: application and not everything wants to be registered |
| 60 | #: multiple times on it, this attribute can be used to figure |
| 61 | #: out if the blueprint was registered in the past already. |
| 62 | self.first_registration = first_registration |
| 63 | |
| 64 | subdomain = self.options.get("subdomain") |
| 65 | if subdomain is None: |
| 66 | subdomain = self.blueprint.subdomain |
| 67 | |
| 68 | #: The subdomain that the blueprint should be active for, ``None`` |
| 69 | #: otherwise. |
| 70 | self.subdomain = subdomain |
| 71 | |
| 72 | url_prefix = self.options.get("url_prefix") |
| 73 | if url_prefix is None: |
| 74 | url_prefix = self.blueprint.url_prefix |
| 75 | #: The prefix that should be used for all URLs defined on the |
| 76 | #: blueprint. |
| 77 | self.url_prefix = url_prefix |
| 78 | |
| 79 | self.name = self.options.get("name", blueprint.name) |
| 80 | self.name_prefix = self.options.get("name_prefix", "") |
| 81 | |
| 82 | #: A dictionary with URL defaults that is added to each and every |
| 83 | #: URL that was defined with the blueprint. |
| 84 | self.url_defaults = dict(self.blueprint.url_values_defaults) |
| 85 | self.url_defaults.update(self.options.get("url_defaults", ())) |
| 86 | |
| 87 | def add_url_rule( |
| 88 | self, |