Skip to content

Commit

Permalink
fix paster db clean
Browse files Browse the repository at this point in the history
  • Loading branch information
kindly committed Jul 23, 2013
1 parent ef1f218 commit e60c59e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ckan/config/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,3 +356,6 @@ def genshi_lookup_attr(cls, obj, key):
except sqlalchemy.exc.ProgrammingError:
# The database is not initialised. This is a bit dirty.
pass
# if an extension or our code does not finish
# transaction properly db cli commands can fail
model.Session.remove()
5 changes: 3 additions & 2 deletions ckan/logic/action/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -1843,8 +1843,9 @@ def get_site_user(context, data_dict):
user.sysadmin = True
model.Session.add(user)
model.Session.flush()
if not context.get('defer_commit'):
model.Session.commit()
if not context.get('defer_commit'):
model.repo.commit_and_remove()

return {'name': user.name,
'apikey': user.apikey}

Expand Down

3 comments on commit e60c59e

@seanh
Copy link
Contributor

@seanh seanh commented on e60c59e Jan 6, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amercader Should this commit be backported to 2.1.2? It looks like paster db clean is currently broken (hangs forever) on 2.1.1 and 2.1.2 (but it's fine on 2.2 and master, which both have this commit)

@seanh
Copy link
Contributor

@seanh seanh commented on e60c59e Jan 6, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seanh
Copy link
Contributor

@seanh seanh commented on e60c59e Jan 6, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait, sorry, it seems I had paster serve running in another tab and that was making db clean freeze, it's fine on 2.1.1 and 2.1.2, never mind

Please sign in to comment.