Преглед изворни кода

[minor] frappe.are_emails_muted

version-14
Anand Doshi пре 10 година
родитељ
комит
94de362e3c
3 измењених фајлова са 6 додато и 3 уклоњено
  1. +3
    -0
      frappe/__init__.py
  2. +1
    -1
      frappe/email/bulk.py
  3. +2
    -2
      frappe/email/smtp.py

+ 3
- 0
frappe/__init__.py Прегледај датотеку

@@ -919,6 +919,9 @@ def as_json(obj, indent=1):
from frappe.utils.response import json_handler from frappe.utils.response import json_handler
return json.dumps(obj, indent=indent, sort_keys=True, default=json_handler) return json.dumps(obj, indent=indent, sort_keys=True, default=json_handler)


def are_emails_muted():
return flags.mute_emails or conf.get("mute_emails") or False

def get_test_records(doctype): def get_test_records(doctype):
"""Returns list of objects from `test_records.json` in the given doctype's folder.""" """Returns list of objects from `test_records.json` in the given doctype's folder."""
from frappe.modules import get_doctype_module, get_module_path from frappe.modules import get_doctype_module, get_module_path


+ 1
- 1
frappe/email/bulk.py Прегледај датотеку

@@ -190,7 +190,7 @@ def flush(from_test=False):
# additional check # additional check
check_bulk_limit([]) check_bulk_limit([])


if frappe.flags.mute_emails or frappe.conf.get("mute_emails") or False:
if frappe.are_emails_muted():
msgprint(_("Emails are muted")) msgprint(_("Emails are muted"))
from_test = True from_test = True




+ 2
- 2
frappe/email/smtp.py Прегледај датотеку

@@ -15,7 +15,7 @@ def send(email, append_to=None):
frappe.flags.sent_mail = email.as_string() frappe.flags.sent_mail = email.as_string()
return return


if frappe.flags.mute_emails or frappe.conf.get("mute_emails") or False:
if frappe.are_emails_muted():
frappe.msgprint(_("Emails are muted")) frappe.msgprint(_("Emails are muted"))
return return


@@ -81,7 +81,7 @@ def get_default_outgoing_email_account(raise_exception_not_set=True):
if not email_account and not raise_exception_not_set: if not email_account and not raise_exception_not_set:
return None return None


if frappe.flags.mute_emails or frappe.conf.get("mute_emails") or False:
if frappe.are_emails_muted():
# create a stub # create a stub
email_account = frappe.new_doc("Email Account") email_account = frappe.new_doc("Email Account")
email_account.update({ email_account.update({


Loading…
Откажи
Сачувај