You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2022/01/29 17:14:18 UTC

[incubator-ponymail-foal] 01/02: Simplify calling structure

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

commit 319e5dbac1840c772690c714494aae3074663264
Author: Sebb <se...@apache.org>
AuthorDate: Sat Jan 29 17:13:28 2022 +0000

    Simplify calling structure
---
 server/endpoints/mbox.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/server/endpoints/mbox.py b/server/endpoints/mbox.py
index 01c1e98..fa249d8 100644
--- a/server/endpoints/mbox.py
+++ b/server/endpoints/mbox.py
@@ -33,8 +33,7 @@ import email.utils as eutils
 import datetime
 
 
-async def convert_source(session: plugins.session.SessionObject, email: dict) -> str:
-    source = await plugins.messages.get_source(session, permalink=email.get("dbid"))
+def convert_source(source) -> str:
     if source:
         source_as_text = source["_source"]["source"]
         # Ensure it starts with "From "...or fake it
@@ -110,7 +109,8 @@ async def process(
         epoch_order="asc"
     ):
         for email in emails:
-            mboxrd_source = await convert_source(session, email)
+            source = await plugins.messages.get_source(session, permalink=email.get("dbid"))
+            mboxrd_source = convert_source(source)
             # Ensure each non-empty source ends with a blank line
             if not mboxrd_source.endswith("\n\n"):
                 mboxrd_source += "\n"