From 3ddc524361d1d57d6d0f3bbbedfa75585374a3cc Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 30 Apr 2013 16:50:48 +0530 Subject: [PATCH] [form] [comments] fixed --- website/helpers/blog.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/website/helpers/blog.py b/website/helpers/blog.py index 386c4b7f05..9da2062c24 100644 --- a/website/helpers/blog.py +++ b/website/helpers/blog.py @@ -63,15 +63,20 @@ def add_comment(args=None): """ import webnotes import webnotes.utils, markdown2 - import webnotes.widgets.form.comments if not args: args = webnotes.form_dict args['comment'] = unicode(markdown2.markdown(args.get('comment') or '')) + args['doctype'] = "Comment" - comment = webnotes.widgets.form.comments.add_comment(args) + page_name = args.get("page_name") + if "page_name" in args: + del args["page_name"] + + comment = webnotes.bean(args) + comment.insert() # since comments are embedded in the page, clear the web cache - webnotes.webutils.clear_cache(args.get('page_name')) + webnotes.webutils.clear_cache(page_name) comment['comment_date'] = webnotes.utils.global_date_format(comment['creation']) template_args = { 'comment_list': [comment], 'template': 'app/website/templates/html/comment.html' }