소스 검색

[fix] minor catch TemplateError for Email Alert

version-14
Rushabh Mehta 9 년 전
부모
커밋
a3ae74fa92
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. +5
    -1
      frappe/email/doctype/email_alert/email_alert.py

+ 5
- 1
frappe/email/doctype/email_alert/email_alert.py 파일 보기

@@ -34,6 +34,7 @@ def trigger_daily_alerts():
trigger_email_alerts(None, "daily") trigger_email_alerts(None, "daily")


def trigger_email_alerts(doc, method=None): def trigger_email_alerts(doc, method=None):
from jinja2 import TemplateError
if frappe.flags.in_import or frappe.flags.in_patch: if frappe.flags.in_import or frappe.flags.in_patch:
# don't send email alerts while syncing or patching # don't send email alerts while syncing or patching
return return
@@ -71,7 +72,10 @@ def trigger_email_alerts(doc, method=None):


for alert in frappe.db.sql_list("""select name from `tabEmail Alert` for alert in frappe.db.sql_list("""select name from `tabEmail Alert`
where document_type=%s and event=%s and enabled=1""", (doc.doctype, eevent)): where document_type=%s and event=%s and enabled=1""", (doc.doctype, eevent)):
evaluate_alert(doc, alert, eevent)
try:
evaluate_alert(doc, alert, eevent)
except TemplateError:
frappe.throw(_("Error while evaluating Email Alert {0}. Please fix your template.").format(alert))


def evaluate_alert(doc, alert, event): def evaluate_alert(doc, alert, event):
if isinstance(alert, basestring): if isinstance(alert, basestring):


불러오는 중...
취소
저장