| 16 | |
| 17 | |
| 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 | |
| 55 | def get_send_file_max_age(self, filename: str | None) -> int | None: |
| 56 | """Used by :func:`send_file` to determine the ``max_age`` cache |
| 57 | value for a given file path if it wasn't passed. |
| 58 | |
| 59 | By default, this returns :data:`SEND_FILE_MAX_AGE_DEFAULT` from |
| 60 | the configuration of :data:`~flask.current_app`. This defaults |
| 61 | to ``None``, which tells the browser to use conditional requests |
| 62 | instead of a timed cache, which is usually preferable. |
| 63 | |
| 64 | Note this is a duplicate of the same method in the Flask |
| 65 | class. |
| 66 | |
| 67 | .. versionchanged:: 2.0 |
| 68 | The default configuration is ``None`` instead of 12 hours. |
| 69 | |
| 70 | .. versionadded:: 0.9 |
| 71 | """ |
| 72 | value = current_app.config["SEND_FILE_MAX_AGE_DEFAULT"] |
| 73 | |
| 74 | if value is None: |
| 75 | return None |
no outgoing calls