Type checking fixes
diff --git a/server/plugins/messages.py b/server/plugins/messages.py
index 584df4d..7443954 100644
--- a/server/plugins/messages.py
+++ b/server/plugins/messages.py
@@ -558,6 +558,7 @@
"""Turns a flat array of emails into a nested structure of threads"""
for cur_email in sorted(self.emails, key=lambda x: x["epoch"]):
author = cur_email.get("from")
+ assert(author)
if author not in self.authors:
self.authors[author] = [0, cur_email.get("gravatar", "")]
self.authors[author][0] += 1
diff --git a/tools/archiver.py b/tools/archiver.py
index 2feb887..96e831a 100755
--- a/tools/archiver.py
+++ b/tools/archiver.py
@@ -158,6 +158,7 @@
# Allow for empty string
if fd is None:
return None, None
+ assert(isinstance(fd, bytes)) # decode=True generates bytes
if filename:
attachment = {
"content_type": part.get_content_type(),
@@ -202,6 +203,7 @@
self.bytes = part.get_payload(decode=True)
self.html_as_source = False
if self.bytes is not None:
+ assert(isinstance(self.bytes, bytes)) # decode=True generates bytes
valid_encodings = [x for x in self.charsets if x]
if valid_encodings:
for cs in valid_encodings: