From 0f1660ef5a4b501ed604d2ed82de8fdb04167d3f Mon Sep 17 00:00:00 2001 From: Amritanshu Date: Mon, 6 Mar 2023 22:02:21 +0530 Subject: [PATCH] Fix: Regime was stripping the whitespaces from header --- barker/barker/routers/regime.py | 6 +++--- barker/barker/schemas/regime.py | 3 --- .../app/regimes/regime-detail/regime-detail.component.html | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/barker/barker/routers/regime.py b/barker/barker/routers/regime.py index 3a54fce..e0ed6bb 100644 --- a/barker/barker/routers/regime.py +++ b/barker/barker/routers/regime.py @@ -24,7 +24,7 @@ def save( try: with SessionFuture() as db: regime_id = db.execute(select(func.coalesce(func.max(Regime.id), 0) + 1)).scalar_one() - item = Regime(id=regime_id, name=data.name, header=data.header, prefix=data.prefix) + item = Regime(id=regime_id, name=data.name.strip(), header=data.header, prefix=data.prefix.strip()) db.add(item) db.commit() return regime_info(item) @@ -49,9 +49,9 @@ def update_route( status_code=status.HTTP_423_LOCKED, detail=f"{item.name} is a fixture and cannot be edited or deleted.", ) - item.name = data.name + item.name = data.name.strip() item.header = data.header - item.prefix = data.prefix + item.prefix = data.prefix.strip() db.commit() return regime_info(item) except SQLAlchemyError as e: diff --git a/barker/barker/schemas/regime.py b/barker/barker/schemas/regime.py index 851b8d1..1670a39 100644 --- a/barker/barker/schemas/regime.py +++ b/barker/barker/schemas/regime.py @@ -10,7 +10,6 @@ class RegimeIn(BaseModel): is_fixture: bool class Config: - anystr_strip_whitespace = True alias_generator = to_camel @@ -18,7 +17,6 @@ class Regime(RegimeIn): id_: int class Config: - anystr_strip_whitespace = True alias_generator = to_camel @@ -28,7 +26,6 @@ class RegimeBlank(RegimeIn): prefix: str class Config: - anystr_strip_whitespace = True alias_generator = to_camel diff --git a/bookie/src/app/regimes/regime-detail/regime-detail.component.html b/bookie/src/app/regimes/regime-detail/regime-detail.component.html index 3a35d30..c2c26b5 100644 --- a/bookie/src/app/regimes/regime-detail/regime-detail.component.html +++ b/bookie/src/app/regimes/regime-detail/regime-detail.component.html @@ -13,7 +13,7 @@
Header - +