From f8132f4d024b4801185572ca8ebc64b04b075b34 Mon Sep 17 00:00:00 2001 From: OzzieIsaacs Date: Tue, 14 Aug 2018 17:38:38 +0200 Subject: [PATCH] Fix for #574 --- cps/worker.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/cps/worker.py b/cps/worker.py index 6ac5fbf2..2916c2b4 100644 --- a/cps/worker.py +++ b/cps/worker.py @@ -84,16 +84,12 @@ def get_attachment(bookpath, filename): return attachment - # Class for sending email with ability to get current progress -class email(smtplib.SMTP): +class emailbase(): transferSize = 0 progress = 0 - def __init__(self, *args, **kwargs): - smtplib.SMTP.__init__(self, *args, **kwargs) - def data(self, msg): self.transferSize = len(msg) (code, resp) = smtplib.SMTP.data(self, msg) @@ -138,8 +134,15 @@ class email(smtplib.SMTP): return "100 %" -# Class for sending ssl encrypted email with ability to get current progress -class email_SSL(email, smtplib.SMTP_SSL): +# Class for sending email with ability to get current progress, derived from emailbase class +class email(emailbase, smtplib.SMTP): + + def __init__(self, *args, **kwargs): + smtplib.SMTP.__init__(self, *args, **kwargs) + + +# Class for sending ssl encrypted email with ability to get current progress, , derived from emailbase class +class email_SSL(emailbase, smtplib.SMTP_SSL): def __init__(self, *args, **kwargs): smtplib.SMTP_SSL.__init__(self, *args, **kwargs)