From b05b6226098642ab3632b928baa7f798dbff638f Mon Sep 17 00:00:00 2001 From: eric Date: Mon, 12 Aug 2013 17:22:24 -0400 Subject: [PATCH] not all records have 050 and 082; code for 082 was putting call number in Dewey! --- core/ungluify_record.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/core/ungluify_record.py b/core/ungluify_record.py index e854c203..0a7e6526 100644 --- a/core/ungluify_record.py +++ b/core/ungluify_record.py @@ -105,18 +105,24 @@ def makemarc(marcfile, edition): # change 050 and 082 indicators because LOC is no longer responsible for these # no easy indicator change function, so we'll just reconstruct the fields - field050 = record.get_fields('050')[0] - field050_new = field050 - field050_new.indicators = [' ', '4'] - record.remove_field(field050) - record.add_ordered_field(field050_new) - - field082 = record.get_fields('050')[0] - field082_new = field050 - field082_new.indicators = [' ', '4'] - record.remove_field(field082) - record.add_ordered_field(field082_new) + try: + field050 = record.get_fields('050')[0] + field050_new = field050 + field050_new.indicators = [' ', '4'] + record.remove_field(field050) + record.add_ordered_field(field050_new) + except: + pass # if no 050 field, don't need to change indicator + try: + field082 = record.get_fields('082')[0] + field082_new = field082 + field082_new.indicators = [' ', '4'] + record.remove_field(field082) + record.add_ordered_field(field082_new) + except: + pass # if no 082 field, don't need to change indicator + # add subfield to 245 indicating format field245 = record.get_fields('245')[0] field245.add_subfield('h', '[electronic resource]')