In all cases, move the creation of a new transaction outside of the block

handling exceptions raised inside that transaction.  If the creation (start) of
the transaction fails, then t has not been assigned, and in any case no
transaction has been created, so it is wrong to attempt to abort that
(non-existent) transaction.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
This commit is contained in:
emellor@ewan committed 2005-09-18 10:09:22 +01:00
1 parent ab2a633ba1
commit 00cac7da1c
1 file changed
+6 -6
+6 -6
View File
@@ -151,8 +151,8 @@ class xstransact:
def Read(cls, path, *args):
while True:
t = cls(path)
try:
t = cls(path)
v = t.read(*args)
t.commit()
return v
@@ -170,8 +170,8 @@ class xstransact:
def Write(cls, path, *args, **opts):
while True:
t = cls(path)
try:
t = cls(path)
t.write(*args, **opts)
t.commit()
return
@@ -189,8 +189,8 @@ class xstransact:
def Remove(cls, path, *args):
while True:
t = cls(path)
try:
t = cls(path)
t.remove(*args)
t.commit()
return
@@ -208,8 +208,8 @@ class xstransact:
def List(cls, path, *args):
while True:
t = cls(path)
try:
t = cls(path)
v = t.list(*args)
t.commit()
return v
@@ -227,8 +227,8 @@ class xstransact:
def Gather(cls, path, *args):
while True:
t = cls(path)
try:
t = cls(path)
v = t.gather(*args)
t.commit()
return v
@@ -246,8 +246,8 @@ class xstransact:
def Store(cls, path, *args):
while True:
t = cls(path)
try:
t = cls(path)
v = t.store(*args)
t.commit()
return v
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.