Changeset - cfbc0d6860ca
[Not reviewed]
default
0 4 0
domruf - 9 years ago 2017-05-09 21:29:17
dominikruf@gmail.com
sqlalchemy: be consistent, always use Session() instead of just Session
4 files changed with 7 insertions and 9 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/journal.py
Show inline comments
 
@@ -254,7 +254,7 @@ class JournalController(BaseController):
 
            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 @@ class JournalController(BaseController):
 
            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())
kallithea/lib/auth.py
Show inline comments
 
@@ -43,7 +43,6 @@ from webob.exc import HTTPFound, HTTPBad
 
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 @@ def set_available_permissions(config):
 
    """
 
    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()
 

	
 

	
 
#==============================================================================
kallithea/tests/api/api_base.py
Show inline comments
 
@@ -278,7 +278,7 @@ class _BaseTestApi(object):
 
        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,)
kallithea/tests/functional/test_pullrequests.py
Show inline comments
 
@@ -296,12 +296,12 @@ class TestPullrequestsGetRepoRefs(TestCo
 
        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):
0 comments (0 inline, 0 general)