We had always been adding the last two characters of 245$h, even if they
were just "].", which messes up some records. Let's only add them if
they are " /".
Signed-off-by: Dan Scott <dan@coffeecode.net>
clean_opts["input"] = _input
clean_opts["output"] = _output
clean_opts["settings"] = Institution()
- clean_opts["date"] = datetime.date.fromisoformat(clean_opts["date"])
+ if "date" in clean_opts:
+ clean_opts["date"] = datetime.date.fromisoformat(clean_opts["date"])
return clean_opts
date_cutoff = False
- if options["date"]:
+ if "date" in options:
u = record["856"]["u"]
date_match = re.search(r"([\d]{4})-([\d]{2})-([\d]{2})", u)
# Grab the trailing " /"
suffix = field["h"][-2:]
field.delete_subfield("h")
- field["a"] = field["a"] + suffix
+ if suffix == " /":
+ field["a"] = field["a"] + suffix
new_record.add_ordered_field(field)
else:
new_record.add_ordered_field(field)