AttributeError while adding another email address to your account

Bug #1437866 reported by Pavan Koli
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Postorius
In Progress
Undecided
Pavan Koli

Bug Description

Under settings tab, after selecting add email address option.
If any email id is entered for saving
The following error arises

AttributeError at /postorius/users/address_activation/
'Settings' object has no attribute 'EMAIL_CONFIRMATION_FROM'

After looking into it, the error seems to be in models.py file under postorius.

The line containing error(http://bazaar.launchpad.net/~mailman-coders/postorius/trunk/view/head:/src/postorius/models.py#L294)

Adding self.mail solves the problem

getattr(settings, 'EMAIL_CONFIRMATION_FROM', self.mail)

Tried after editing the line and got Email address activation sent message on the screen

Attaching a patch

Tags: postorius
Revision history for this message
Pavan Koli (pskoli93) wrote :
Pavan Koli (pskoli93)
Changed in postorius:
status: New → In Progress
assignee: nobody → Pavan Koli (pskoli93)
Revision history for this message
Florian Fuchs (flo-fuchs) wrote :

settings.EMAIL_CONFIRMATION_FROM is supposed to contain the general From-Address for email confirmations. self.email in this context however contains the new address someone wants to add to a Mailman user record -- which means the confirmation email would come from the same address it has been sent from.

I think a better fallback for settings.EMAIL_CONFIRMATION_FROM could be settings.DEFAULT_FROM_EMAIL which is suggested as a general Email-`from`-default in the Django docs. If both don't exist it's probably best to raise Django's `ImproperlyConfigured` exception. This will still raise a 500 if settings.DEBUG == False, but the traceback sent to the Admins will be much more meaningful and will alert them to check the configuration rather than looking for a bug in the code.

Revision history for this message
Florian Fuchs (flo-fuchs) wrote :

Typo in 1st paragraph: "the confirmation email would come from the same address it has been sent *to*"

Revision history for this message
Pavan Koli (pskoli93) wrote :

I have attached a patch, now it raises ImproperlyConfigured error instead of the AttributeError.
Added the following code.

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")

Revision history for this message
Ashish (coolyashish) wrote :

Hi pranav,

Sorry for the late reply but I think this bug is duplicated.

https://bugs.launchpad.net/postorius/+bug/1430682

Revision history for this message
Pavan Koli (pskoli93) wrote :

Hello Ashish,

Actually my name is Pavan, well I didn't come across your bug report while filing mine so may be that's why duplication occurred. I didn't find any option to mark the bug as duplicate and redirect it to your bug report. I think it will be better that I attach my patch and branch to your bug report as you had filed the report before me.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.