def _event_person_from_legacy(self, old_person): data = dict(first_name=convert_to_unicode(old_person._firstName), last_name=convert_to_unicode(old_person._surName), _title=self.USER_TITLE_MAP.get( getattr(old_person, '_title', ''), UserTitle.none), affiliation=convert_to_unicode(old_person._affilliation), address=convert_to_unicode(old_person._address), phone=convert_to_unicode(old_person._telephone)) email = strict_sanitize_email(old_person._email) if email: person = (self.event_persons_by_email.get(email) or self.event_persons_by_user.get( self.importer.all_users_by_email.get(email))) else: person = self.event_persons_noemail_by_data.get( (data['first_name'], data['last_name'], data['affiliation'])) if not person: user = self.importer.all_users_by_email.get(email) person = EventPerson(event_new=self.event, user=user, email=email, **data) if email: self.event_persons_by_email[email] = person if user: self.event_persons_by_user[user] = person if not email and not user: self.event_persons_noemail_by_data[( person.first_name, person.last_name, person.affiliation)] = person person_link = AbstractPersonLink(person=person) person_link.populate_from_dict(data) return person_link
def _event_person_from_legacy(self, old_person): data = dict(first_name=convert_to_unicode(old_person._firstName), last_name=convert_to_unicode(old_person._surName), _title=self.USER_TITLE_MAP.get(getattr(old_person, '_title', ''), UserTitle.none), affiliation=convert_to_unicode(old_person._affilliation), address=convert_to_unicode(old_person._address), phone=convert_to_unicode(old_person._telephone)) email = strict_sanitize_email(old_person._email) if email: person = (self.event_persons_by_email.get(email) or self.event_persons_by_user.get(self.importer.all_users_by_email.get(email))) else: person = self.event_persons_noemail_by_data.get((data['first_name'], data['last_name'], data['affiliation'])) if not person: user = self.importer.all_users_by_email.get(email) person = EventPerson(event_new=self.event, user=user, email=email, **data) if email: self.event_persons_by_email[email] = person if user: self.event_persons_by_user[user] = person if not email and not user: self.event_persons_noemail_by_data[(person.first_name, person.last_name, person.affiliation)] = person person_link = AbstractPersonLink(person=person) person_link.populate_from_dict(data) return person_link
def _person_link_from_legacy(self, old_person): person = self.event_person_from_legacy(old_person) person_link = AbstractPersonLink(person=person) data = dict(first_name=convert_to_unicode(old_person._firstName), last_name=convert_to_unicode(old_person._surName), _title=self.USER_TITLE_MAP.get(getattr(old_person, '_title', ''), UserTitle.none), affiliation=convert_to_unicode(old_person._affilliation), address=convert_to_unicode(old_person._address), phone=convert_to_unicode(old_person._telephone)) person_link.populate_from_dict(data) return person_link