Skip to content

Commit

Permalink
Make sure to call db.commit() even on non select queries
Browse files Browse the repository at this point in the history
  • Loading branch information
romanchyla committed Aug 23, 2016
1 parent fbaa576 commit a0f69e0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions adsws/accounts/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def cleanup_users(app_override=None, timedelta="hours=24"):
try:
db.session.commit()
except Exception, e:
db.session.rollback()
app.logger.error("Could not cleanup stale users. "
"Database error; rolled back: {0}".format(e))
app.logger.info("Deleted {0} stale users".format(deletions))
Expand Down
4 changes: 2 additions & 2 deletions adsws/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,6 @@ def bootstrap_user():
is_internal=True,
)
db.session.add(token)
db.session.commit()
current_app.logger.info(
"Created BB client for {email}".format(email=current_user.email)
)
Expand All @@ -708,6 +707,7 @@ def bootstrap_user():
client_id=client.client_id,
user_id=current_user.get_id(),
).first()


db.session.commit()
return client, token

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def run_tests(self):
ADS Web Services
-------------------------------------
Astrophysics Data System (http://adslabs.org) provides the search and
Astrophysics Data System (http://adslabs.org) provides the search and
discovery of scientific papers for astrophysics, astronomy and related fields
Our services are accessible through the API. And this is the software
Expand Down

0 comments on commit a0f69e0

Please sign in to comment.