Skip to content

Commit ec1d225

Browse files
committed
Fixed issues with bad parsing when 0 emails are found
1 parent e23d408 commit ec1d225

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

email/1.2.0/src/app.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def send_email_smtp(
135135
#return files
136136
#data["attachments"] = files
137137
except Exception as e:
138-
print(f"Error in attachment parsing for email: {e}")
138+
self.logger.info(f"Error in attachment parsing for email: {e}")
139139

140140

141141
try:
@@ -146,7 +146,7 @@ def send_email_smtp(
146146
"reason": f"Failed to send mail: {e}"
147147
}
148148

149-
print("Successfully sent email with subject %s to %s" % (subject, recipient))
149+
self.logger.info("Successfully sent email with subject %s to %s" % (subject, recipient))
150150
return {
151151
"success": True,
152152
"reason": "Email sent to %s!" % recipient,
@@ -241,11 +241,11 @@ def merge(d1, d2):
241241
if id_list == None:
242242
return {
243243
"success": False,
244-
"reason": "Couldn't retrieve email. Data: %s" % data,
244+
"reason": f"Couldn't retrieve email. Data: {data}",
245245
}
246246

247247
try:
248-
print("LIST: ", len(id_list))
248+
self.logger.info(f"LIST: {id_list}")
249249
except TypeError:
250250
return {
251251
"success": False,
@@ -274,7 +274,7 @@ def merge(d1, d2):
274274
if len(id_list) == 0:
275275
return {
276276
"success": True,
277-
"emails": json.dumps(emails, default=default),
277+
"emails": [],
278278
}
279279

280280
try:
@@ -283,7 +283,7 @@ def merge(d1, d2):
283283
error = None
284284

285285
if resp != "OK":
286-
print("Failed getting %s" % id_list[i])
286+
self.logger.info("Failed getting %s" % id_list[i])
287287
continue
288288

289289
if data == None:

0 commit comments

Comments
 (0)