From 8f4b8ccdf68bdaaa9bce8438fe4b48f5eada1e17 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 22 Aug 2021 15:41:39 +0200 Subject: [PATCH] Migration: remplace espaces (et strip) les anciens logins. --- tools/import_scodoc7_user_db.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/import_scodoc7_user_db.py b/tools/import_scodoc7_user_db.py index aa2d1a0c8e..c92f3b528f 100644 --- a/tools/import_scodoc7_user_db.py +++ b/tools/import_scodoc7_user_db.py @@ -23,10 +23,11 @@ def import_scodoc7_user_db(scodoc7_db="dbname=SCOUSERS"): cursor = cnx.cursor(cursor_factory=psycopg2.extras.DictCursor) cursor.execute("SELECT * FROM sco_users;") for u7 in cursor: - if User.query.filter_by(user_name=u7["user_name"]).first(): + user_name = u7["user_name"].strip().replace(" ", "_") + if User.query.filter_by(user_name=user_name).first(): # user with same name exists ! current_app.logger.warning( - "User {} exists and is left unchanged".format(u7["user_name"]) + f"""User {user_name} (de {u7["user_name"]}) exists and is left unchanged""" ) else: u = User(