# HG changeset patch # User domruf # Date 1494358157 -7200 # Node ID cfbc0d6860ca4980626a06cb187965c52aed9e5b # Parent a32ca3200ca7161cbb426e38e528deb4b28eef03 sqlalchemy: be consistent, always use Session() instead of just Session diff -r a32ca3200ca7 -r cfbc0d6860ca kallithea/controllers/journal.py --- a/kallithea/controllers/journal.py Sat May 13 03:53:49 2017 +0200 +++ b/kallithea/controllers/journal.py Tue May 09 21:29:17 2017 +0200 @@ -254,7 +254,7 @@ try: self.scm_model.toggle_following_user(user_id, request.authuser.user_id) - Session.commit() + Session().commit() return 'ok' except Exception: log.error(traceback.format_exc()) @@ -265,7 +265,7 @@ try: self.scm_model.toggle_following_repo(repo_id, request.authuser.user_id) - Session.commit() + Session().commit() return 'ok' except Exception: log.error(traceback.format_exc()) diff -r a32ca3200ca7 -r cfbc0d6860ca kallithea/lib/auth.py --- a/kallithea/lib/auth.py Sat May 13 03:53:49 2017 +0200 +++ b/kallithea/lib/auth.py Tue May 09 21:29:17 2017 +0200 @@ -43,7 +43,6 @@ from kallithea import __platform__, is_windows, is_unix from kallithea.config.routing import url from kallithea.lib.vcs.utils.lazy import LazyProperty -from kallithea.model import meta from kallithea.model.meta import Session from kallithea.model.user import UserModel from kallithea.model.db import User, Repository, Permission, \ @@ -724,11 +723,10 @@ """ log.info('getting information about all available permissions') try: - sa = meta.Session - all_perms = sa.query(Permission).all() + all_perms = Session().query(Permission).all() config['available_permissions'] = [x.permission_name for x in all_perms] finally: - meta.Session.remove() + Session.remove() #============================================================================== diff -r a32ca3200ca7 -r cfbc0d6860ca kallithea/tests/api/api_base.py --- a/kallithea/tests/api/api_base.py Sat May 13 03:53:49 2017 +0200 +++ b/kallithea/tests/api/api_base.py Tue May 09 21:29:17 2017 +0200 @@ -278,7 +278,7 @@ repo_name = u'test_pull' r = fixture.create_repo(repo_name, repo_type=self.REPO_TYPE) r.clone_uri = os.path.join(Ui.get_by_key('paths', '/').ui_value, self.REPO) - Session.commit() + Session().commit() id_, params = _build_data(self.apikey, 'pull', repoid=repo_name,) diff -r a32ca3200ca7 -r cfbc0d6860ca kallithea/tests/functional/test_pullrequests.py --- a/kallithea/tests/functional/test_pullrequests.py Sat May 13 03:53:49 2017 +0200 +++ b/kallithea/tests/functional/test_pullrequests.py Tue May 09 21:29:17 2017 +0200 @@ -296,12 +296,12 @@ self.repo_name = u'main' repo = fixture.create_repo(self.repo_name, repo_type='hg') self.repo_scm_instance = repo.scm_instance - Session.commit() + Session().commit() self.c = PullrequestsController() def teardown_method(self, method): fixture.destroy_repo(u'main') - Session.commit() + Session().commit() Session.remove() def test_repo_refs_empty_repo(self):