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)