def author_from_data(loc, data): edition = read_edition(loc, data) assert 'authors' in edition east = east_in_by_statement(edition) assert len(edition['authors']) == 1 print `edition['authors'][0]` a = import_author(edition['authors'][0], eastern=east) if 'key' in a: return {'key': a['key']} ret = ol.new(a, comment='new author') print 'ret:', ret assert isinstance(ret, basestring) return {'key': ret}
print part, size if not go: if part == start['part']: go = True print "starting %s at %d" % (part, start['pos']) part_iter = load_part(archive_id, part, start_pos=start['pos']) else: continue else: part_iter = load_part(archive_id, part) for loc, data in part_iter: #if loc == 'marc_binghamton_univ/bgm_openlib_final_10-15.mrc:265680068:4538': # continue try: edition = read_edition(loc, data) except AssertionError: print loc raise if not edition: continue if edition['title'] == 'See.': print 'See.', edition continue if edition['title'] == 'See also.': print 'See also.', edition continue load_count += 1 if load_count % 100 == 0: print "load count", load_count write_edition(loc, edition)