db: always use Session() for compatibility, Using Session is actually the
scoped_session which is not the same as the one which we "call". More here: http://docs.sqlalchemy.org/en/latest/orm/contextual.html#contextual-thread-local-sessions
This commit is contained in:
parent
7794877876
commit
708038952c
7 changed files with 10 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ def merge_pull_request(request, apiuser, repoid, pullrequestid,
|
|||
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, repoid, pullrequestid,
|
|||
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue