Pavan Koli has proposed merging lp:~pskoli93/postorius/Models into lp:postorius.
Commit message:
Fix for Attribute error raised during addition of new email id.
Requested reviews:
Terri (terriko)
Related bugs:
Bug #1430682 in Postorius: "AttributeError at
/postorius/users/address_activation/"
https://bugs.launchpad.net/postorius/+bug/1430682
Bug #1437866 in Postorius: "AttributeError while adding another email address
to your account"
https://bugs.launchpad.net/postorius/+bug/1437866
For more details, see:
https://code.launchpad.net/~pskoli93/postorius/Models/+merge/256102
Failing to configure EMAIL_CONFIRMATION_FROM raised an attribute error instead
of ImproperlyConfigured Error.
Now this fix lets it check if EMAIL_CONFIRMATION_FROM is configured or not, if
not then it checks for configuration of DEFAULT_FROM_EMAIL. Even if it is not
configured than ImproperlyConfigured Error is raised. This error helps to
identify that there are faults in the configuration and not in the code.
--
Your team Mailman Coders is subscribed to branch lp:postorius.
=== modified file 'src/postorius/models.py'
--- src/postorius/models.py 2015-04-13 21:51:14 +0000
+++ src/postorius/models.py 2015-04-14 05:04:23 +0000
@@ -36,7 +36,7 @@
from mailmanclient import MailmanConnectionError
from postorius.utils import get_client
from urllib2 import HTTPError
-
+from django.core.exceptions import ImproperlyConfigured
logger = logging.getLogger(__name__)
@@ -288,6 +288,10 @@
if not template_context:
template_context = Context(
{'activation_link': activation_link, 'host_url': host_url})
+
+ mail_from=getattr(settings, 'EMAIL_CONFIRMATION_FROM', getattr(settings, 'DEFAULT_FROM_EMAIL', 'NONE'))
+ if(mail_from == 'NONE'):
+ raise ImproperlyConfigured("Configurations have not been done properly, EMAIL_CONFIRMATION_FROM or DEFAULT_FROM_EMAIL value(s) have not been set")
email_subject = getattr(
settings, 'EMAIL_CONFIRMATION_SUBJECT', u'Confirmation needed')
try:
@@ -303,5 +307,9 @@
send_mail(email_subject,
get_template(template_path).render(template_context),
+<<<<<<< TREE
sender_address,
+=======
+ mail_from,
+>>>>>>> MERGE-SOURCE
[self.email])
_______________________________________________
Mailman-coders mailing list
[email protected]
https://mail.python.org/mailman/listinfo/mailman-coders