From a00292129478a2b38673fd39cd361c7142166d4d Mon Sep 17 00:00:00 2001 From: "Jannis M. Hoffmann" Date: Fri, 8 Dec 2023 13:01:13 +0100 Subject: get header fields as optional --- src/jwebmail/__init__.py | 2 +- src/jwebmail/model/read_mails.py | 2 +- src/jwebmail/render_mail.py | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/jwebmail') diff --git a/src/jwebmail/__init__.py b/src/jwebmail/__init__.py index 665d85c..c8be663 100644 --- a/src/jwebmail/__init__.py +++ b/src/jwebmail/__init__.py @@ -35,7 +35,7 @@ else: toml_read_file = dict(load=toml_load, text=True) -__version__ = "2.0.0.dev4" +__version__ = "2.0.0.dev5" def validate_config(app): diff --git a/src/jwebmail/model/read_mails.py b/src/jwebmail/model/read_mails.py index ccd9bb9..b322a16 100644 --- a/src/jwebmail/model/read_mails.py +++ b/src/jwebmail/model/read_mails.py @@ -27,9 +27,9 @@ class QMailAuthuser: try: completed_proc = subprocess_run( f"{self._authenticator} true 3<&0", + input=f"{self._username}\0{self._password}\0\0".encode(), shell=True, timeout=2, - input=f"{self._username}\0{self._password}\0\0".encode(), ) if completed_proc.returncode == 0: return True diff --git a/src/jwebmail/render_mail.py b/src/jwebmail/render_mail.py index 804b200..588959c 100644 --- a/src/jwebmail/render_mail.py +++ b/src/jwebmail/render_mail.py @@ -114,10 +114,10 @@ def render_message(subtype, msg, path): R += '
' R += f"
{escape(gettext('Subject'))}
" R += f"
{escape(msg['head']['subject'])}
\n" - R += _format_header(gettext("From"), msg["head"]["from"]) - R += _format_header(gettext("To"), msg["head"]["to"]) - R += _format_header(gettext("CC"), msg["head"]["cc"]) - R += _format_header(gettext("BCC"), msg["head"]["bcc"]) + R += _format_header(gettext("From"), msg["head"].get("from")) + R += _format_header(gettext("To"), msg["head"].get("to")) + R += _format_header(gettext("CC"), msg["head"].get("cc")) + R += _format_header(gettext("BCC"), msg["head"].get("bcc")) R += f"
{escape(gettext('Date'))}
" R += f"
{escape(msg['head']['date'])}
\n" R += f"
{escape(gettext('Content-Type'))}
" -- cgit v1.2.3