X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FPersons.py;h=5a0240379790c8c33badb819fbf9be12e31e69e3;hb=fe81b2c91b436b1882f63023413c7f51b29538ed;hp=be3f2d3ca2f7ce6f8aa09ffdb66df792d9ec726a;hpb=65056a32be3655c4bd4793bdde02ac465bc62d84;p=plcapi.git diff --git a/PLC/Persons.py b/PLC/Persons.py index be3f2d3c..5a024037 100644 --- a/PLC/Persons.py +++ b/PLC/Persons.py @@ -9,7 +9,6 @@ # from types import StringTypes -from datetime import datetime try: from hashlib import md5 except ImportError: @@ -81,25 +80,25 @@ class Person(Row): """ Validate email address. Stolen from Mailman. """ - + email = email.lower() invalid_email = PLCInvalidArgument("Invalid e-mail address") if not email: raise invalid_email - email_re = re.compile('\A[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9._\-]+\.[a-zA-Z]+\Z') + email_re = re.compile('\A[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9._\-]+\.[a-zA-Z]+\Z') if not email_re.match(email): raise invalid_email # check only against users on the same peer - if 'peer_id' in self: + if 'peer_id' in self: namespace_peer_id = self['peer_id'] else: namespace_peer_id = None - conflicts = Persons(self.api, {'email':email,'peer_id':namespace_peer_id}) + conflicts = Persons(self.api, {'email':email,'peer_id':namespace_peer_id}) - for person in conflicts: + for person in conflicts: if 'person_id' not in self or self['person_id'] != person['person_id']: raise PLCInvalidArgument, "E-mail address already in use"