sql: do not fail on transient_data store if session is not found (#67454)
This commit is contained in:
parent
4050ddd838
commit
5f40d72c87
|
@ -240,11 +240,14 @@ def test_transient_data_removal(pub, app):
|
|||
|
||||
assert sql.Session.count() == 1
|
||||
assert sql.TransientData.count() == 1
|
||||
transient_data = sql.TransientData.select()[0]
|
||||
|
||||
app.get('/logout')
|
||||
assert sql.Session.count() == 0
|
||||
assert sql.TransientData.count() == 0
|
||||
|
||||
transient_data.store() # session_id not found, should not fail
|
||||
|
||||
|
||||
def test_magictoken_migration(pub, app):
|
||||
pub.session_manager.session_class.wipe()
|
||||
|
|
|
@ -3394,7 +3394,11 @@ class TransientData(SqlMixin):
|
|||
', '.join(['%%(%s)s' % x for x in column_names]),
|
||||
', '.join(['%s = %%(%s)s' % (x, x) for x in column_names]),
|
||||
)
|
||||
cur.execute(sql_statement, sql_dict)
|
||||
try:
|
||||
cur.execute(sql_statement, sql_dict)
|
||||
except psycopg2.IntegrityError as e:
|
||||
if "transient_data_session_id_fkey" not in str(e):
|
||||
raise
|
||||
|
||||
conn.commit()
|
||||
cur.close()
|
||||
|
|
Loading…
Reference in New Issue