summaryrefslogtreecommitdiff
path: root/src/mailman/rest/helpers.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/rest/helpers.py')
-rw-r--r--src/mailman/rest/helpers.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mailman/rest/helpers.py b/src/mailman/rest/helpers.py
index 9ab1f434e..6b45eb78a 100644
--- a/src/mailman/rest/helpers.py
+++ b/src/mailman/rest/helpers.py
@@ -23,11 +23,13 @@ import hashlib
from contextlib import suppress
from datetime import datetime, timedelta
+from email.header import Header
+from email.message import Message
from enum import Enum
from lazr.config import as_boolean
-from mailman import public
from mailman.config import config
from pprint import pformat
+from public import public
class ExtendedEncoder(json.JSONEncoder):
@@ -49,6 +51,10 @@ class ExtendedEncoder(json.JSONEncoder):
return obj.name
elif isinstance(obj, bytes):
return bytes_to_str(obj)
+ elif isinstance(obj, Message):
+ return obj.as_string()
+ elif isinstance(obj, Header):
+ return str(obj)
return super().default(obj)