From b05b6226098642ab3632b928baa7f798dbff638f Mon Sep 17 00:00:00 2001 From: eric Date: Mon, 12 Aug 2013 17:22:24 -0400 Subject: [PATCH 1/2] 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]') From 40bcf62f99233492cf0a62129ad8a47672036206 Mon Sep 17 00:00:00 2001 From: eric Date: Mon, 12 Aug 2013 17:22:55 -0400 Subject: [PATCH 2/2] edition.ebooks is always true --- frontend/templates/work.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/templates/work.html b/frontend/templates/work.html index f99de0bc..0197d2e8 100644 --- a/frontend/templates/work.html +++ b/frontend/templates/work.html @@ -383,7 +383,7 @@ {% for record in edition.MARCrecords.all %} Download {{record.link_target}} MARC record for this edition: (XML) (mrc)
{% endfor %} - {% if user.is_staff and edition.ebooks %} + {% if user.is_staff and edition.ebooks.count %} Upload a MARC record for this edition.
{% endif %}