Migration: remplace espaces (et strip) les anciens logins.
This commit is contained in:
parent
c3d6c1f40f
commit
8f4b8ccdf6
@ -23,10 +23,11 @@ def import_scodoc7_user_db(scodoc7_db="dbname=SCOUSERS"):
|
|||||||
cursor = cnx.cursor(cursor_factory=psycopg2.extras.DictCursor)
|
cursor = cnx.cursor(cursor_factory=psycopg2.extras.DictCursor)
|
||||||
cursor.execute("SELECT * FROM sco_users;")
|
cursor.execute("SELECT * FROM sco_users;")
|
||||||
for u7 in cursor:
|
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 !
|
# user with same name exists !
|
||||||
current_app.logger.warning(
|
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:
|
else:
|
||||||
u = User(
|
u = User(
|
||||||
|
Loading…
Reference in New Issue
Block a user