File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44def clean_email_address (addr ):
55 addr = addr .replace ("!" , "@" ).replace ("(at)" , "@" ) # some obvious @ replacements
6- addr = addr [addr .rfind ('<' ) + 1 :addr .find ('>' )] # whack surrounding <...>
6+ # whack surrounding <...>
7+ addr = addr [addr .rfind ('<' ) + 1 :]
8+ end = addr .find ('>' )
9+ if end != - 1 :
10+ addr = addr [:end ]
711 addr = addr .strip ()
812 if not "@" in addr :
913 return ""
@@ -42,8 +46,15 @@ def get_or_create_email(o, create_fake):
4246 if aliases :
4347 p = aliases [0 ].person
4448 else :
45- p = Person .objects .create (id = person .pk , name = n , ascii = asciified )
46- # FIXME: fill in address?
49+ p = Person (id = person .pk , name = n , ascii = asciified )
50+
51+ from ietf .idtracker .models import PostalAddress
52+ addresses = person .postaladdress_set .filter (address_priority = 1 )
53+ if addresses :
54+ p .affiliation = (addresses [0 ].affiliated_company or "" ).strip ()
55+ # should probably import p.address here
56+
57+ p .save ()
4758
4859 Alias .objects .create (name = n , person = p )
4960 if asciified != n :
You can’t perform that action at this time.
0 commit comments