mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-27 21:16:28 +02:00
revert db_helpers change
This commit is contained in:
parent
b8504592c5
commit
7c613a01f8
1 changed files with 8 additions and 9 deletions
|
@ -9,13 +9,12 @@ def ignore_unique_violation():
|
||||||
Execute within an atomic transaction so that if a unique constraint violation occurs,
|
Execute within an atomic transaction so that if a unique constraint violation occurs,
|
||||||
the individual transaction is rolled back without invalidating any larger transaction.
|
the individual transaction is rolled back without invalidating any larger transaction.
|
||||||
"""
|
"""
|
||||||
try:
|
with transaction.atomic():
|
||||||
# NOTE - is transaction doing anything here??
|
try:
|
||||||
with transaction.atomic():
|
|
||||||
yield
|
yield
|
||||||
except IntegrityError as e:
|
except IntegrityError as e:
|
||||||
if e.__cause__.pgcode == errorcodes.UNIQUE_VIOLATION:
|
if e.__cause__.pgcode == errorcodes.UNIQUE_VIOLATION:
|
||||||
# roll back to the savepoint, effectively ignoring this transaction
|
# roll back to the savepoint, effectively ignoring this transaction
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
raise e
|
raise e
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue