From a672a13789c21eef0fdaf0397bc14937f95d2ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Sun, 26 Feb 2023 08:00:58 +0800 Subject: [PATCH] Revised the strip_text filter to return None when the text is empty. --- src/accounting/utils/strip_text.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/accounting/utils/strip_text.py b/src/accounting/utils/strip_text.py index 8311f04..cf04ab8 100644 --- a/src/accounting/utils/strip_text.py +++ b/src/accounting/utils/strip_text.py @@ -29,4 +29,5 @@ def strip_text(s: str | None) -> str | None: """ if s is None: return None - return s.strip() + s = s.strip() + return s if s != "" else None