Added the transaction management.

This commit is contained in:
2023-02-27 15:28:45 +08:00
parent 9383f5484f
commit 05fde3a742
42 changed files with 7090 additions and 2 deletions

View File

@ -19,6 +19,7 @@
This module should not import any other module from the application.
"""
import re
def strip_text(s: str | None) -> str | None:
@ -31,3 +32,15 @@ def strip_text(s: str | None) -> str | None:
return None
s = s.strip()
return s if s != "" else None
def strip_multiline_text(s: str | None) -> str | None:
"""The filter to strip a piece of multi-line text.
:param s: The text input string.
:return: The filtered string.
"""
if s is None:
return None
s = re.sub(r"^\s*\n", "", s.rstrip())
return s if s != "" else None