From 3b6482cb0ab7eb51756213ccf7b7c8822fbda3d5 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Tue, 7 Jul 2020 12:40:28 +0530 Subject: Fixed 10 Anti-Pattern issues --- app/run_local.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app/run_local.py') diff --git a/app/run_local.py b/app/run_local.py index 094d024..4b902d2 100644 --- a/app/run_local.py +++ b/app/run_local.py @@ -8,7 +8,7 @@ mycursor.execute(sql_select_Query) records = mycursor.fetchall() -def email(zi): +def email(zipArchive): import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText @@ -25,10 +25,10 @@ def email(zi): body = "Attached Zip contains the docked files, PLIP report and PyMOL Visualisations. If the ZIP file does not contain these files, please report this issue by replying to this email. Job was submitted on {} with the description {}".format(date, description) msg.attach(MIMEText(body, 'plain')) - filename = "Curie_Web_Results_Job_ID_" + str(jobID) + ".zip" - attachment = open((str(zi) + ".zip"), "rb") + filename = "Curie_Web_Results_Job_ID_" + str(jobID) + ".zip" p = MIMEBase('application', 'octet-stream') - p.set_payload((attachment).read()) + with open((str(zipArchive) + ".zip"), "rb") as attachment: + p.set_payload((attachment).read()) encoders.encode_base64(p) p.add_header('Content-Disposition', "attachment; filename= %s" % filename) msg.attach(p) -- cgit v1.2.3