Skip to content

Commit 9835b28

Browse files
author
Jim Fulton
committed
Don't abort before commit. It isn't necessary and aborting might lose important changes.
1 parent f2a1c4c commit 9835b28

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

karl/box/archive.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,6 @@ def realize_archive(archive, folder, path, copied):
270270
try:
271271
folder.upload(name, item.open())
272272
except:
273-
transaction.abort()
274-
transaction.begin()
275273
community.archive_copied = copied
276274
community.archive_last_copied = joined
277275
transaction.commit()
@@ -285,7 +283,6 @@ def realize_archive(archive, folder, path, copied):
285283
log.info("Resuming copy of: %s", resource_path(community))
286284
folder = box.root().get_or_make('Karl Archive', *path)
287285
if folder and not copied:
288-
transaction.abort()
289286
raise ValueError(
290287
'Cannot archive community, folder already exists: %s' % (
291288
'/' + '/'.join(path)))

karl/box/client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,14 @@ def api_call(self, method, url, *args, **kw):
114114
}).json()
115115

116116
if 'error' in response:
117-
with transaction.manager:
118-
box.logout()
117+
box.logout()
118+
transaction.commit()
119119
raise BoxError(
120120
response['error'], response['error_description'])
121121

122-
with transaction.manager:
123-
box.access_token = response['access_token']
124-
box.refresh_token = response['refresh_token']
122+
box.access_token = response['access_token']
123+
box.refresh_token = response['refresh_token']
124+
transaction.commit()
125125

126126
kw['headers']['Authorization'] = 'Bearer ' + box.access_token
127127
response = session_method(url, *args, **kw)

0 commit comments

Comments
 (0)