|
4 | 4 | import typing as t
|
5 | 5 | from datetime import timedelta
|
6 | 6 |
|
| 7 | +from .cli import AppGroup |
7 | 8 | from .globals import current_app
|
8 | 9 | from .helpers import send_from_directory
|
9 | 10 | from .sansio.blueprints import Blueprint as SansioBlueprint
|
10 | 11 | from .sansio.blueprints import BlueprintSetupState as BlueprintSetupState # noqa
|
| 12 | +from .sansio.scaffold import _sentinel |
11 | 13 |
|
12 | 14 | if t.TYPE_CHECKING: # pragma: no cover
|
13 | 15 | from .wrappers import Response
|
14 | 16 |
|
15 | 17 |
|
16 | 18 | class Blueprint(SansioBlueprint):
|
| 19 | + def __init__( |
| 20 | + self, |
| 21 | + name: str, |
| 22 | + import_name: str, |
| 23 | + static_folder: str | os.PathLike[str] | None = None, |
| 24 | + static_url_path: str | None = None, |
| 25 | + template_folder: str | os.PathLike[str] | None = None, |
| 26 | + url_prefix: str | None = None, |
| 27 | + subdomain: str | None = None, |
| 28 | + url_defaults: dict[str, t.Any] | None = None, |
| 29 | + root_path: str | None = None, |
| 30 | + cli_group: str | None = _sentinel, # type: ignore |
| 31 | + ) -> None: |
| 32 | + super().__init__( |
| 33 | + name, |
| 34 | + import_name, |
| 35 | + static_folder, |
| 36 | + static_url_path, |
| 37 | + template_folder, |
| 38 | + url_prefix, |
| 39 | + subdomain, |
| 40 | + url_defaults, |
| 41 | + root_path, |
| 42 | + cli_group, |
| 43 | + ) |
| 44 | + |
| 45 | + #: The Click command group for registering CLI commands for this |
| 46 | + #: object. The commands are available from the ``flask`` command |
| 47 | + #: once the application has been discovered and blueprints have |
| 48 | + #: been registered. |
| 49 | + self.cli = AppGroup() |
| 50 | + |
| 51 | + # Set the name of the Click group in case someone wants to add |
| 52 | + # the app's commands to another CLI tool. |
| 53 | + self.cli.name = self.name |
| 54 | + |
17 | 55 | def get_send_file_max_age(self, filename: str | None) -> int | None:
|
18 | 56 | """Used by :func:`send_file` to determine the ``max_age`` cache
|
19 | 57 | value for a given file path if it wasn't passed.
|
|
0 commit comments