You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2020/09/09 09:44:25 UTC

[incubator-ponymail-foal] branch master updated: fix mypy warnings

This is an automated email from the ASF dual-hosted git repository.

humbedooh 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 4d0cec7  fix mypy warnings
4d0cec7 is described below

commit 4d0cec7e05d088de36b94d8256375b4cd3c8bdc5
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Wed Sep 9 11:43:24 2020 +0200

    fix mypy warnings
---
 server/endpoints/compose.py | 6 +++---
 server/endpoints/email.py   | 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/server/endpoints/compose.py b/server/endpoints/compose.py
index b403366..003ea9e 100644
--- a/server/endpoints/compose.py
+++ b/server/endpoints/compose.py
@@ -38,11 +38,11 @@ async def process(
     mailhost = server.config.ui.mailhost
     mailport = 25
     if ':' in mailhost:
-        mailhost, mailport = mailhost.split(':', 1)
-        mailport = int(mailport)
+        mailhost, _mailport = mailhost.split(':', 1)
+        mailport = int(_mailport)
 
     # Figure out if recipient list is on allowed list
-    to = indata.get('to')
+    to = indata.get('to', '')
     mldomain = to.strip("<>").split('@')[-1]
     allowed_to_send = False
     for allowed_domain in server.config.ui.sender_domains.split(' '):
diff --git a/server/endpoints/email.py b/server/endpoints/email.py
index 69a696f..97b60dd 100644
--- a/server/endpoints/email.py
+++ b/server/endpoints/email.py
@@ -61,6 +61,7 @@ async def process(
                                 "Content-Disposition"
                             ] = f"attachment; filename=\"{entry.get('filename')}\""
                         try:
+                            assert session.database, "Database not connected!"
                             attachment = await session.database.get(
                                 index=session.database.dbs.attachment, id=indata.get("file")
                             )