sql: don't fail on get if id is an int (#59786)

This commit is contained in:
Lauréline Guérin 2021-12-16 14:31:11 +01:00
parent 5acf986c2c
commit 73237402b8
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
2 changed files with 5 additions and 1 deletions

View File

@ -96,6 +96,10 @@ def test_sql_get():
assert formdata.user_id == '5'
assert formdata.status == 'wf-0'
assert data_class.get('foo', ignore_errors=True) is None
assert data_class.get(True, ignore_errors=True) is None
assert data_class.get(False, ignore_errors=True) is None
def test_sql_store_channel():
data_class = formdef.data_class(mode='sql')

View File

@ -2290,7 +2290,7 @@ class SqlDataMixin(SqlMixin):
@guard_postgres
def get(cls, id, ignore_errors=False, ignore_migration=False):
try:
int(id)
int(str(id))
except (TypeError, ValueError):
if ignore_errors:
return None