Skip to content

Commit 7e9596c

Browse files
authored
Fix internal settings and parsing (#266)
1 parent bddc076 commit 7e9596c

5 files changed

Lines changed: 28 additions & 8 deletions

File tree

docs/en/docs/release-notes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ hide:
1818
### Fixed
1919

2020
- Runserver when no autodiscovery was enabled.
21+
- Initial settings was not initialising properly in the constructor.
22+
- Edgy template was being wrongly renamed.
2123

2224
## 0.19.7
2325

lilya/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.19.7"
1+
__version__ = "0.19.8"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from edgy import EdgySettings
2+
3+
4+
class EdgyAppSettings(EdgySettings): ...

lilya/apps.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -867,13 +867,13 @@ async def create_user(request: Request):
867867
),
868868
] = None,
869869
redirect_slashes: Annotated[
870-
bool,
870+
bool | None,
871871
Doc(
872872
"""
873873
Enable or disable automatic trailing slash redirection for HTTP routes.
874874
"""
875875
),
876-
] = True,
876+
] = None,
877877
lifespan: Annotated[
878878
Lifespan[ApplicationType] | None,
879879
Doc(
@@ -886,7 +886,7 @@ async def create_user(request: Request):
886886
),
887887
] = None,
888888
include_in_schema: Annotated[
889-
bool,
889+
bool | None,
890890
Doc(
891891
"""
892892
Enable or disable inclusion of the application in a OpenAPI schema integration.
@@ -896,7 +896,7 @@ async def create_user(request: Request):
896896
flags that can be used for any possible integration.
897897
"""
898898
),
899-
] = True,
899+
] = None,
900900
logging_config: Annotated[
901901
LoggingConfig | None,
902902
Doc(
@@ -951,7 +951,7 @@ async def populate_g(connection: Connection):
951951
Enable or disable OpenAPI documentation generation. Defaults to False.
952952
"""
953953
),
954-
] = False,
954+
] = None,
955955
openapi_config: Annotated[
956956
Any | None,
957957
Doc(
@@ -970,7 +970,7 @@ async def populate_g(connection: Connection):
970970
With this flag enable, Lilya custom middleware activates those.
971971
"""
972972
),
973-
] = False,
973+
] = None,
974974
root_path: Annotated[
975975
str | None,
976976
Doc(
@@ -1046,11 +1046,17 @@ async def populate_g(connection: Connection):
10461046
"enable_intercept_global_exceptions", enable_intercept_global_exceptions
10471047
)
10481048
self.root_path = self.load_settings_value("root_path", root_path)
1049+
self.redirect_slashes = self.load_settings_value(
1050+
"redirect_slashes", redirect_slashes, is_boolean=True
1051+
)
1052+
self.include_in_schema = self.load_settings_value(
1053+
"include_in_schema", include_in_schema, is_boolean=True
1054+
)
10491055

10501056
if self.router_class is not None:
10511057
self.router = self.router_class(
10521058
routes=routes,
1053-
redirect_slashes=redirect_slashes,
1059+
redirect_slashes=self.redirect_slashes,
10541060
permissions=self.custom_permissions,
10551061
on_startup=on_startup,
10561062
on_shutdown=on_shutdown,

lilya/conf/global_settings.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,14 @@ async def create_user(request: Request):
488488
"""
489489
),
490490
] = ""
491+
redirect_slashes: Annotated[
492+
bool,
493+
Doc(
494+
"""
495+
Enable or disable automatic trailing slash redirection for HTTP routes.
496+
"""
497+
),
498+
] = True
491499

492500
@property
493501
def routes(self) -> list[Any]:

0 commit comments

Comments
 (0)