~abompard/mailman/pgsql_upgrade

« back to all changes in this revision

Viewing changes to src/mailman/model/address.py

  • Committer: Barry Warsaw
  • Date: 2014-04-15 03:12:01 UTC
  • mfrom: (7240.1.1 floaddr)
  • Revision ID: barry@list.org-20140415031201-td1fuuyvptco2pqy
 * Addresses can be added to existing users, including display names, via the
   REST API.  [Florian Fuchs]

Also, email addresses are validated when they are added via the IUserManager
interface.  They are still also validated when subscribing to a mailing list,
but that is redundant.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
from email.utils import formataddr
29
29
from storm.locals import DateTime, Int, Reference, Unicode
 
30
from zope.component import getUtility
30
31
from zope.event import notify
31
32
from zope.interface import implementer
32
33
 
33
34
from mailman.database.model import Model
34
 
from mailman.interfaces.address import AddressVerificationEvent, IAddress
 
35
from mailman.interfaces.address import (
 
36
    AddressVerificationEvent, IAddress, IEmailValidator)
35
37
from mailman.utilities.datetime import now
36
38
 
37
39
 
54
56
 
55
57
    def __init__(self, email, display_name):
56
58
        super(Address, self).__init__()
 
59
        getUtility(IEmailValidator).validate(email)
57
60
        lower_case = email.lower()
58
61
        self.email = lower_case
59
62
        self.display_name = display_name