From: Tony Mack Date: Wed, 24 Mar 2010 20:57:22 +0000 (+0000) Subject: convert email to lowercase X-Git-Tag: PLCAPI-5.0-5~5 X-Git-Url: http://git.onelab.eu/?p=plcapi.git;a=commitdiff_plain;h=6285e1dc65964ec9a976cf47d3535c2106dc32a5 convert email to lowercase --- diff --git a/PLC/Persons.py b/PLC/Persons.py index be3f2d3..7f7bd3c 100644 --- a/PLC/Persons.py +++ b/PLC/Persons.py @@ -81,25 +81,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"