From 31c40b64929ef537153ed7d95fb598add8e12ed2 Mon Sep 17 00:00:00 2001 From: viennet Date: Tue, 15 Dec 2020 08:48:29 +0100 Subject: [PATCH] updated email imports --- ZScoDoc.py | 2 +- sco_import_users.py | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ZScoDoc.py b/ZScoDoc.py index 4205ed517..397f9f551 100644 --- a/ZScoDoc.py +++ b/ZScoDoc.py @@ -45,8 +45,8 @@ import traceback from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText -from email.mime.base import MIMEBase from email.header import Header +from email.mime.base import MIMEBase from sco_zope import ( ObjectManager, diff --git a/sco_import_users.py b/sco_import_users.py index e614a0fa0..cc11b38b6 100644 --- a/sco_import_users.py +++ b/sco_import_users.py @@ -39,8 +39,7 @@ TITLES = ("user_name", "nom", "prenom", "email", "roles", "dept") def generate_excel_sample(): - """generates an excel document suitable to import users - """ + """generates an excel document suitable to import users""" style = sco_excel.Excel_MakeStyle(bold=True) titles = TITLES titlesStyles = [style] * len(titles) @@ -105,7 +104,7 @@ def import_users(U, auth_dept="", context=None): - créer utilisateur et mettre le mot de passe - envoyer mot de passe par mail - En cas d'erreur: supprimer tous les utilisateurs que l'on vient de créer. + En cas d'erreur: supprimer tous les utilisateurs que l'on vient de créer. """ created = [] # liste de uid créés try: @@ -164,11 +163,11 @@ def generate_password(): return "".join(RNG.sample(l, PASSLEN)) -from email.MIMEMultipart import MIMEMultipart -from email.MIMEText import MIMEText -from email.MIMEBase import MIMEBase -from email.Header import Header -from email import Encoders +import email +from email.mime.multipart import MIMEMultipart +from email.mime.text import MIMEText +from email.mime.base import MIMEBase +from email.header import Header def mail_password(u, context=None, reset=False):