def get_editors(line, conn): results = [] editors = line.split(',') if len(editors) < 2: names = editors else: names = [] for i in range(0, len(editors), 2): names.append(editors[i] + ',' + editors[i+1]) for name in names: p = Person(name.strip()) id = p.store(conn) if id: results.append(id) return results
def get_composers(composers, conn): composers = composers.split(';') results = [] for composer in composers: name = re.sub('\(.*\)', "", composer).strip() born, died = None, None match = re.search(born_regex, composer) if match: born = match.group(1) match = re.search(died_regex, composer) if match: died = match.group(1) p = Person(name, born, died) id = p.store(conn) if id: results.append(id) return results