comparison rhodecode/controllers/changeset.py @ 1749:8ecc6b8229a5 beta

commit less models - models don't do any commits(with few exceptions) - all db transactions should be handled by higher level modules like controllers, celery tasks
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 02 Dec 2011 22:31:13 +0200
parents 7d1fc253549e
children f28dc032adf0
comparison
equal deleted inserted replaced
1748:a3ee2611e6e8 1749:8ecc6b8229a5
278 repo_id=c.rhodecode_db_repo.repo_id, 278 repo_id=c.rhodecode_db_repo.repo_id,
279 user_id=c.rhodecode_user.user_id, 279 user_id=c.rhodecode_user.user_id,
280 revision=revision, 280 revision=revision,
281 f_path=request.POST.get('f_path'), 281 f_path=request.POST.get('f_path'),
282 line_no=request.POST.get('line')) 282 line_no=request.POST.get('line'))
283 Session().commit() 283 Session.commit()
284 return redirect(h.url('changeset_home', repo_name=repo_name, 284 return redirect(h.url('changeset_home', repo_name=repo_name,
285 revision=revision)) 285 revision=revision))
286 286
287 @jsonify 287 @jsonify
288 def delete_comment(self, repo_name, comment_id): 288 def delete_comment(self, repo_name, comment_id):
289 co = ChangesetComment.get(comment_id) 289 co = ChangesetComment.get(comment_id)
290 owner = lambda : co.author.user_id == c.rhodecode_user.user_id 290 owner = lambda : co.author.user_id == c.rhodecode_user.user_id
291 if h.HasPermissionAny('hg.admin', 'repository.admin')() or owner: 291 if h.HasPermissionAny('hg.admin', 'repository.admin')() or owner:
292 ChangesetCommentsModel().delete(comment=co) 292 ChangesetCommentsModel().delete(comment=co)
293 Session().commit() 293 Session.commit()
294 return True 294 return True
295 else: 295 else:
296 raise HTTPForbidden() 296 raise HTTPForbidden()
297 297