fixing when webpage get_context has any exception (#2338)

This commit is contained in:
Omar Ali 2016-11-18 10:36:27 +02:00 committed by Rushabh Mehta
parent 90cffeff6e
commit b30780dc2a

View file

@ -6,6 +6,7 @@ import frappe
from frappe.website.doctype.website_settings.website_settings import get_website_settings
from frappe.website.router import get_page_context
import frappe.utils
def get_context(path, args=None):
if args and args.source:
@ -43,9 +44,13 @@ def update_controller_context(context, controller):
context[prop] = getattr(module, prop)
if hasattr(module, "get_context"):
ret = module.get_context(context)
if ret:
context.update(ret)
try:
ret = module.get_context(context)
if ret:
context.update(ret)
except Exception:
frappe.errprint(frappe.utils.get_traceback())
if hasattr(module, "get_children"):
context.children = module.get_children(context)
@ -152,3 +157,4 @@ def add_metatags(context):
if tags.get("image"):
tags["og:image"] = tags["twitter:image:src"] = tags["image"]