def normalize_format_three(self, fields): if (len(fields) != 5 or not self.name.match(fields[0]) or not self.name.match(fields[1]) or not self.zip.match(fields[2]) or not self.phone.match(fields[3]) or not self.name.match(fields[4])): return None entry = Entry() entry.first_name = fields[0] entry.last_name = fields[1] entry.zip = fields[2] entry.phone = self.normalize_phone(fields[3]) entry.color = fields[4] return entry
def normalize_format_two(self, fields): if (len(fields) != 4 or not self.name.match(fields[0]) or not self.name.match(fields[1]) or not self.zip.match(fields[2]) or not self.phone.match(fields[3])): return None entry = Entry() names = self.normalize_split_name(fields[0]) if len(names) != 2: return None entry.first_name = names[0] entry.last_name = names[1] entry.color = fields[1] entry.zip = fields[2] entry.phone = self.normalize_phone(fields[3]) return entry
def normalize_format_one(self, fields): # Some of these may have been checked by caller, but # fairly cheap check so let's not make assumptions if (len(fields) != 5 or not self.name.match(fields[0]) or not self.name.match(fields[1]) or not self.formatted_phone.match(fields[2]) or not self.name.match(fields[3]) or not self.zip.match(fields[4])): return None entry = Entry() entry.last_name = fields[0] entry.first_name = fields[1] entry.phone = self.normalize_formatted_phone(fields[2]) entry.color = fields[3] entry.zip = fields[4] return entry