This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
The following commit(s) were added to refs/heads/master by this push:
new d37d8bd Use constant for repeated string
d37d8bd is described below
commit d37d8bd570af926143a1285cc7d31f56233bf410
Author: Sebb <[email protected]>
AuthorDate: Sun May 9 15:10:51 2021 +0100
Use constant for repeated string
---
server/plugins/mbox.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/server/plugins/mbox.py b/server/plugins/mbox.py
index a17f2a2..7952a37 100644
--- a/server/plugins/mbox.py
+++ b/server/plugins/mbox.py
@@ -38,6 +38,7 @@ import plugins.session
import plugins.database
PYPONY_RE_PREFIX = re.compile(r"^([a-zA-Z]+:\s*)+")
+DATABASE_NOT_CONNECTED = "Database not connected!"
mbox_cache_privacy: typing.Dict[str, bool] = {}
@@ -182,7 +183,7 @@ async def get_email(
irt=None,
source=False,
):
- assert session.database, "Database not connected!"
+ assert session.database, DATABASE_NOT_CONNECTED
doctype = session.database.dbs.mbox
if source:
doctype = session.database.dbs.source
@@ -248,7 +249,7 @@ async def get_email(
async def get_source(session: plugins.session.SessionObject, permalink: str =
None, raw=False):
- assert session.database, "Database not connected!"
+ assert session.database, DATABASE_NOT_CONNECTED
doctype = session.database.dbs.source
try:
doc = await session.database.get(index=doctype, id=permalink)
@@ -312,7 +313,7 @@ async def query(
"""
docs = []
hits = 0
- assert session.database, "Database not connected!"
+ assert session.database, DATABASE_NOT_CONNECTED
async for hit in session.database.scan(
query={
"query": {"bool": query_defuzzed},