diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..b7f21468 --- /dev/null +++ b/.flake8 @@ -0,0 +1,3 @@ +[flake8] + max-line-length = 88 + ignore = E203,W503 \ No newline at end of file diff --git a/app/email.py b/app/email.py index a75b2def..a983ef2d 100644 --- a/app/email.py +++ b/app/email.py @@ -79,13 +79,15 @@ Adresses d'origine: to : {orig_to} cc : {orig_cc} bcc: {orig_bcc} ---- +--- \n\n""" + msg.body ) current_app.logger.info( - f"""email sent to{' (mode test)' if email_test_mode_address else ''}: {msg.recipients} + f"""email sent to{ + ' (mode test)' if email_test_mode_address else '' + }: {msg.recipients} from sender {msg.sender} """ ) @@ -98,7 +100,8 @@ def get_from_addr(dept_acronym: str = None): """L'adresse "from" à utiliser pour envoyer un mail Si le departement est spécifié, ou si l'attribut `g.scodoc_dept`existe, - prend le `email_from_addr` des préférences de ce département si ce champ est non vide. + prend le `email_from_addr` des préférences de ce département si ce champ + est non vide. Sinon, utilise le paramètre global `email_from_addr`. Sinon, la variable de config `SCODOC_MAIL_FROM`. """ diff --git a/app/scodoc/sco_abs.py b/app/scodoc/sco_abs.py index 1e56ca87..8a04cac2 100755 --- a/app/scodoc/sco_abs.py +++ b/app/scodoc/sco_abs.py @@ -318,7 +318,7 @@ def list_abs_in_range( Returns: List of absences """ - if matin != None: + if matin is not None: matin = _toboolean(matin) ismatin = " AND A.MATIN = %(matin)s " else: @@ -387,7 +387,7 @@ def count_abs_just(etudid, debut, fin, matin=None, moduleimpl_id=None) -> int: Returns: An integer. """ - if matin != None: + if matin is not None: matin = _toboolean(matin) ismatin = " AND A.MATIN = %(matin)s " else: @@ -482,7 +482,9 @@ def _get_abs_description(a, cursor=None): else: a["matin"] = False cursor.execute( - """select * from absences where etudid=%(etudid)s and jour=%(jour)s and matin=%(matin)s order by entry_date desc""", + """SELECT * FROM absences + WHERE etudid=%(etudid)s AND jour=%(jour)s AND matin=%(matin)s + ORDER BY entry_date desc""", a, ) A = cursor.dictfetchall() @@ -517,9 +519,9 @@ def list_abs_jour(date, am=True, pm=True, is_abs=True, is_just=None): req = """SELECT DISTINCT etudid, jour, matin FROM ABSENCES A WHERE A.jour = %(date)s """ - if is_abs != None: + if is_abs is not None: req += " AND A.estabs = %(is_abs)s" - if is_just != None: + if is_just is not None: req += " AND A.estjust = %(is_just)s" if not am: req += " AND NOT matin " @@ -883,7 +885,7 @@ def MonthTableBody( descr = ev[4] # cc = [] - if color != None: + if color is not None: cc.append('
Ajout de {nbadded} absences {just_str}justifiées + f"""
Ajout de {nbadded} absences {just_str}justifiées du {datedebut} au {datefin} {indication_module}
""" ) else: H.append( - f"""Aucune date ouvrable + f"""
Aucune date ouvrable entre le {datedebut} et le {datefin} !
""" @@ -152,11 +152,11 @@ def doSignaleAbsence( H.append( f"""Module: +
Module: