mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Fix NameError
This commit is contained in:
parent
09dacde3f3
commit
83531f95e5
1 changed files with 3 additions and 0 deletions
|
|
@ -27,11 +27,14 @@ sync_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def _exclusive_transaction(conn):
|
def _exclusive_transaction(conn):
|
||||||
|
c = None
|
||||||
try:
|
try:
|
||||||
c = conn.execute('BEGIN EXCLUSIVE TRANSACTION')
|
c = conn.execute('BEGIN EXCLUSIVE TRANSACTION')
|
||||||
yield c
|
yield c
|
||||||
c.execute('COMMIT')
|
c.execute('COMMIT')
|
||||||
except BaseException:
|
except BaseException:
|
||||||
|
if c is None:
|
||||||
|
raise
|
||||||
_, e, tb = sys.exc_info()
|
_, e, tb = sys.exc_info()
|
||||||
c.execute('ROLLBACK')
|
c.execute('ROLLBACK')
|
||||||
raise e.with_traceback(tb)
|
raise e.with_traceback(tb)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue