Skip to content

Commit

Permalink
Don't abort before commit. It isn't necessary and aborting might lose…
Browse files Browse the repository at this point in the history
… important changes.
  • Loading branch information
jimfulton committed Aug 8, 2017
1 parent f2a1c4c commit 9835b28
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 0 additions & 3 deletions karl/box/archive.py
Expand Up @@ -270,8 +270,6 @@ def realize_archive(archive, folder, path, copied):
try:
folder.upload(name, item.open())
except:
transaction.abort()
transaction.begin()
community.archive_copied = copied
community.archive_last_copied = joined
transaction.commit()
Expand All @@ -285,7 +283,6 @@ def realize_archive(archive, folder, path, copied):
log.info("Resuming copy of: %s", resource_path(community))
folder = box.root().get_or_make('Karl Archive', *path)
if folder and not copied:
transaction.abort()
raise ValueError(
'Cannot archive community, folder already exists: %s' % (
'/' + '/'.join(path)))
Expand Down
10 changes: 5 additions & 5 deletions karl/box/client.py
Expand Up @@ -114,14 +114,14 @@ def api_call(self, method, url, *args, **kw):
}).json()

if 'error' in response:
with transaction.manager:
box.logout()
box.logout()
transaction.commit()
raise BoxError(
response['error'], response['error_description'])

with transaction.manager:
box.access_token = response['access_token']
box.refresh_token = response['refresh_token']
box.access_token = response['access_token']
box.refresh_token = response['refresh_token']
transaction.commit()

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

0 comments on commit 9835b28

Please sign in to comment.