# except for 924 fields that we create
elif field.tag[0] == '9' and field.tag != '924':
pass
+ # ISBN cleanup
+ elif field.tag == '020':
+ new_isbn = create_clean_isbn(field)
+ new_record.add_ordered_field(new_isbn)
# Strip out 300 fields that only contain placeholders
elif field.tag == '300' and field['a'] == 'p. cm.':
pass
)
record.add_ordered_field(marc_source)
+def create_clean_isbn(field):
+ """Move 020a junk to 020q"""
+
+ if not field.get_subfields('a') or ' ' not in field['a']:
+ return field
+
+ isbn = pymarc.Field(
+ tag = '020',
+ indicators=[field.indicator1, field.indicator2]
+ )
+ for sf in field:
+ if sf[0] == 'a' and ' ' in sf[1]:
+ junk = sf[1].strip()
+ junk = junk[junk.find(' '):].strip()
+ isbn.add_subfield('a', clean_isbn(sf[1]))
+ isbn.add_subfield('q', junk)
+ else:
+ isbn.add_subfield(sf[0], sf[1])
+ return isbn
+
def process_urls(field, options, publisher):
"""Creates 856 fields required by Conifer"""