mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
@@ -20,7 +20,7 @@ def get_blog_list(args=None):
|
|||||||
comment_doctype='Blog' and comment_docname=name) as comments
|
comment_doctype='Blog' and comment_docname=name) as comments
|
||||||
from `tabBlog`
|
from `tabBlog`
|
||||||
where ifnull(published,0)=1
|
where ifnull(published,0)=1
|
||||||
order by published desc, name asc"""
|
order by creation desc, name asc"""
|
||||||
|
|
||||||
from webnotes.widgets.query_builder import add_limit_to_query
|
from webnotes.widgets.query_builder import add_limit_to_query
|
||||||
query, args = add_limit_to_query(query, args)
|
query, args = add_limit_to_query(query, args)
|
||||||
@@ -96,9 +96,7 @@ def add_comment(args=None):
|
|||||||
comment = webnotes.widgets.form.comments.add_comment(args)
|
comment = webnotes.widgets.form.comments.add_comment(args)
|
||||||
|
|
||||||
# since comments are embedded in the page, clear the web cache
|
# since comments are embedded in the page, clear the web cache
|
||||||
website.web_cache.clear_cache(args.get('page_name'),
|
website.web_cache.clear_cache(args.get('page_name'))
|
||||||
args.get('comment_doctype'), args.get('comment_docname'))
|
|
||||||
|
|
||||||
|
|
||||||
comment['comment_date'] = webnotes.utils.global_date_format(comment['creation'])
|
comment['comment_date'] = webnotes.utils.global_date_format(comment['creation'])
|
||||||
template_args = { 'comment_list': [comment], 'template': 'html/comment.html' }
|
template_args = { 'comment_list': [comment], 'template': 'html/comment.html' }
|
||||||
|
|||||||
@@ -48,18 +48,19 @@ def get_page_html(page_name, comments=''):
|
|||||||
return html
|
return html
|
||||||
|
|
||||||
def load_into_cache(page_name):
|
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__),
|
templates_path = os.path.join(os.path.dirname(conf.__file__),
|
||||||
'app', 'website', 'templates')
|
'app', 'website', 'templates')
|
||||||
args = prepare_args(page_name)
|
|
||||||
|
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
jenv = Environment(loader = FileSystemLoader(templates_path))
|
jenv = Environment(loader = FileSystemLoader(templates_path))
|
||||||
html = jenv.get_template(args['template']).render(args)
|
html = jenv.get_template(args['template']).render(args)
|
||||||
return html
|
return html
|
||||||
|
|
||||||
html = build_html()
|
|
||||||
webnotes.cache().set_value("page:" + page_name, html)
|
|
||||||
return html
|
|
||||||
|
|
||||||
def prepare_args(page_name):
|
def prepare_args(page_name):
|
||||||
if page_name == 'index':
|
if page_name == 'index':
|
||||||
|
|||||||
Reference in New Issue
Block a user