Skip to content

Commit

Permalink
[#1714] do not remove session when get_site_user is called
Browse files Browse the repository at this point in the history
See #1714 for all details. This commit includes only the parts relevant
to 2.2.1.
  • Loading branch information
amercader committed Aug 19, 2014
1 parent e3d9d5d commit ad490d9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ckan/logic/action/get.py
Expand Up @@ -1969,8 +1969,8 @@ def get_site_user(context, data_dict):
user.sysadmin = True
model.Session.add(user)
model.Session.flush()
if not context.get('defer_commit'):
model.repo.commit_and_remove()
if not context.get('defer_commit'):
model.repo.commit()

return {'name': user.name,
'apikey': user.apikey}
Expand Down
1 change: 1 addition & 0 deletions ckan/model/__init__.py
Expand Up @@ -227,6 +227,7 @@ def init_db(self):
log.info('Database initialised')

def clean_db(self):
self.commit_and_remove()
meta.metadata = MetaData(self.metadata.bind)
with warnings.catch_warnings():
warnings.filterwarnings('ignore', '.*(reflection|tsvector).*')
Expand Down

0 comments on commit ad490d9

Please sign in to comment.