fix in blog comments and load_from_cache
diff --git a/website/blog.py b/website/blog.py
index 8bb183d..f422c93 100644
--- a/website/blog.py
+++ b/website/blog.py
@@ -96,9 +96,7 @@
comment = webnotes.widgets.form.comments.add_comment(args)
# since comments are embedded in the page, clear the web cache
- website.web_cache.clear_cache(args.get('page_name'),
- args.get('comment_doctype'), args.get('comment_docname'))
-
+ website.web_cache.clear_cache(args.get('page_name'))
comment['comment_date'] = webnotes.utils.global_date_format(comment['creation'])
template_args = { 'comment_list': [comment], 'template': 'html/comment.html' }
diff --git a/website/web_cache.py b/website/web_cache.py
index 9146dd9..76d773f 100644
--- a/website/web_cache.py
+++ b/website/web_cache.py
@@ -48,18 +48,19 @@
return html
def load_into_cache(page_name):
+ args = prepare_args(page_name)
+ html = build_html(args)
+ webnotes.cache().set_value("page:" + page_name, html)
+ return html
+
+def build_html(args):
templates_path = os.path.join(os.path.dirname(conf.__file__),
'app', 'website', 'templates')
- args = prepare_args(page_name)
from jinja2 import Environment, FileSystemLoader
jenv = Environment(loader = FileSystemLoader(templates_path))
html = jenv.get_template(args['template']).render(args)
return html
-
- html = build_html()
- webnotes.cache().set_value("page:" + page_name, html)
- return html
def prepare_args(page_name):
if page_name == 'index':