diff --git a/docs/admin/reset-information.rst b/docs/admin/reset-information.rst --- a/docs/admin/reset-information.rst +++ b/docs/admin/reset-information.rst @@ -30,7 +30,7 @@ account permissions. # Use this example to change user permissions In [1]: adminuser = User.get_by_username('username') In [2]: adminuser.admin = True - In [3]: Session.add(adminuser);Session().commit() + In [3]: Session().add(adminuser);Session().commit() In [4]: exit() Set to read global ``.hgrc`` file diff --git a/rhodecode/api/views/pull_request_api.py b/rhodecode/api/views/pull_request_api.py --- a/rhodecode/api/views/pull_request_api.py +++ b/rhodecode/api/views/pull_request_api.py @@ -265,7 +265,7 @@ def merge_pull_request(request, apiuser, PullRequestModel().close_pull_request( pull_request.pull_request_id, apiuser) - Session.commit() + Session().commit() return data @@ -319,7 +319,7 @@ def close_pull_request(request, apiuser, PullRequestModel().close_pull_request( pull_request.pull_request_id, apiuser) - Session.commit() + Session().commit() data = { 'pull_request_id': pull_request.pull_request_id, 'closed': True, diff --git a/rhodecode/authentication/views.py b/rhodecode/authentication/views.py --- a/rhodecode/authentication/views.py +++ b/rhodecode/authentication/views.py @@ -96,7 +96,7 @@ class AuthnPluginViewBase(object): # Store validated data. for name, value in valid_data.items(): self.plugin.create_or_update_setting(name, value) - Session.commit() + Session().commit() # Display success message and redirect. self.request.session.flash( diff --git a/rhodecode/controllers/journal.py b/rhodecode/controllers/journal.py --- a/rhodecode/controllers/journal.py +++ b/rhodecode/controllers/journal.py @@ -244,7 +244,7 @@ class JournalController(BaseController): try: self.scm_model.toggle_following_user( user_id, c.rhodecode_user.user_id) - Session.commit() + Session().commit() return 'ok' except Exception: raise HTTPBadRequest() @@ -254,7 +254,7 @@ class JournalController(BaseController): try: self.scm_model.toggle_following_repo( repo_id, c.rhodecode_user.user_id) - Session.commit() + Session().commit() return 'ok' except Exception: raise HTTPBadRequest() diff --git a/rhodecode/model/settings.py b/rhodecode/model/settings.py --- a/rhodecode/model/settings.py +++ b/rhodecode/model/settings.py @@ -198,7 +198,7 @@ class SettingsModel(BaseModel): # update if set res.app_settings_value = val - Session.add(res) + Session().add(res) return res def invalidate_settings_cache(self): diff --git a/rhodecode/tests/functional/test_admin_auth_settings.py b/rhodecode/tests/functional/test_admin_auth_settings.py --- a/rhodecode/tests/functional/test_admin_auth_settings.py +++ b/rhodecode/tests/functional/test_admin_auth_settings.py @@ -67,7 +67,7 @@ class TestAuthSettingsController(object) for _plugin in _enabled_plugins: db_plugin = SettingsModel().get_setting_by_name(_plugin) if db_plugin: - Session.delete(db_plugin) + Session().delete(db_plugin) Session().commit() response = self.app.post(url=test_url, params=params) diff --git a/rhodecode/tests/plugin.py b/rhodecode/tests/plugin.py --- a/rhodecode/tests/plugin.py +++ b/rhodecode/tests/plugin.py @@ -1189,8 +1189,8 @@ class UserUtility(object): def _inherit_default_user_permissions(self, user_name, value): user = UserModel().get_by_username(user_name) user.inherit_default_permissions = value - Session.add(user) - Session.commit() + Session().add(user) + Session().commit() def cleanup(self): self._cleanup_permissions()