bzr revid: nwi@openerp.com-20131105095731-whejtyjxttervt8e
This commit is contained in:
Nicolas Wisniewski
2013-11-05 10:57:31 +01:00
+1 -10
View File
@@ -184,22 +184,13 @@ class WebsiteBlog(http.Controller):
@website.route(['/blog/<int:blog_post_id>/comment'], type='http', auth="public")
def blog_post_comment(self, blog_post_id=None, **post):
cr, uid, context = request.cr, request.uid, request.context
# This should only happen if the user has logged off in one tab
# but posts a comment from another tab (kept open)
# Normally, the comment form is hidden (in the template) in public mode
if request.context['is_public_user']:
url = request.httprequest.host_url
return '%s/web#action=redirect&url=%s/blog/%s/post' % (url, url, blog_post_id)
request.registry['blog.post'].message_post(
cr, uid, blog_post_id,
body=post.get('comment'),
type='comment',
subtype='mt_comment',
context=dict(context, mail_create_nosubcribe=True))
return werkzeug.utils.redirect("/blog/%s/" % (blog_post_id))
return werkzeug.utils.redirect(request.httprequest.referrer + "#comments")
@website.route(['/blog/<int:category_id>/new'], type='http', auth="public")
def blog_post_create(self, category_id=None, **post):