From 75f7551f23ab24f0c2b79d8eafc070d9e8300e64 Mon Sep 17 00:00:00 2001 From: TM Date: Fri, 3 May 2019 00:42:03 +0200 Subject: [PATCH 1/3] email_subject*: don't fail if email_subject_template is configured Allow usage of SPIDERMON_EMAIL_SUBJECT_TEMPLATE over SPIDERMON_EMAIL_SUBJECT. If the latter is configured it still has precedence. --- spidermon/contrib/actions/email/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spidermon/contrib/actions/email/__init__.py b/spidermon/contrib/actions/email/__init__.py index 55fa05f9..04eda7cb 100644 --- a/spidermon/contrib/actions/email/__init__.py +++ b/spidermon/contrib/actions/email/__init__.py @@ -59,7 +59,7 @@ def __init__( raise NotConfigured( "You must provide at least one recipient for the message." ) - if not self.subject: + if not self.subject and not self.subject_template: raise NotConfigured("You must provide a subject for the message.") if not ( self.body_text or body_text_template or body_html or self.body_html_template From fa45b006a757cc32d4f54884523a0f48ec7b08a6 Mon Sep 17 00:00:00 2001 From: TM Date: Fri, 3 May 2019 14:37:02 +0200 Subject: [PATCH 2/3] email_subject: Clarify error-meessage --- spidermon/contrib/actions/email/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spidermon/contrib/actions/email/__init__.py b/spidermon/contrib/actions/email/__init__.py index 04eda7cb..c6577607 100644 --- a/spidermon/contrib/actions/email/__init__.py +++ b/spidermon/contrib/actions/email/__init__.py @@ -60,7 +60,7 @@ def __init__( "You must provide at least one recipient for the message." ) if not self.subject and not self.subject_template: - raise NotConfigured("You must provide a subject for the message.") + raise NotConfigured("You must provide a subject (SPIDERMON_EMAIL_SUBJECT) or subject template (SPIDERMON_EMAIL_SUBJECT_TEMPLATE) for the message.") if not ( self.body_text or body_text_template or body_html or self.body_html_template ): From 7051a7d80e35f1e5442a8e821407cdb28ee88a93 Mon Sep 17 00:00:00 2001 From: TM Date: Fri, 3 May 2019 16:55:27 +0200 Subject: [PATCH 3/3] email_subject: Fix line length and formatting --- spidermon/contrib/actions/email/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spidermon/contrib/actions/email/__init__.py b/spidermon/contrib/actions/email/__init__.py index c6577607..cc245a06 100644 --- a/spidermon/contrib/actions/email/__init__.py +++ b/spidermon/contrib/actions/email/__init__.py @@ -60,7 +60,10 @@ def __init__( "You must provide at least one recipient for the message." ) if not self.subject and not self.subject_template: - raise NotConfigured("You must provide a subject (SPIDERMON_EMAIL_SUBJECT) or subject template (SPIDERMON_EMAIL_SUBJECT_TEMPLATE) for the message.") + raise NotConfigured( + "You must provide a subject (SPIDERMON_EMAIL_SUBJECT) or subject " + "template (SPIDERMON_EMAIL_SUBJECT_TEMPLATE) for the message." + ) if not ( self.body_text or body_text_template or body_html or self.body_html_template ):