From: Dan Scott Date: Thu, 11 Aug 2011 15:38:42 +0000 (-0400) Subject: Be more consistent when applying the period to 710 $a X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7bc3dbef7d00300c1fa01d93651e1aab05941f62;p=contrib%2FConifer.git Be more consistent when applying the period to 710 $a Signed-off-by: Dan Scott --- diff --git a/tools/ebooks/prep_ebook_records.py b/tools/ebooks/prep_ebook_records.py index ca05f496a4..aba1d21ef5 100644 --- a/tools/ebooks/prep_ebook_records.py +++ b/tools/ebooks/prep_ebook_records.py @@ -205,7 +205,8 @@ def check_options(options): sys.exit(0) clean_opts = dict() - clean_opts['publisher'] = options['--publisher'] + clean_opts['publisher'] = append_period(options['--publisher']) + clean_opts['consortium'] = options['--consortium'] clean_opts['authorization'] = options['--authorization'] @@ -216,7 +217,7 @@ def check_options(options): clean_opts['note'] = options['--note'] if '--platform' in options: - clean_opts['platform'] = options['--platform'] + clean_opts['platform'] = append_period(options['--platform']) clean_opts['libraries'] = _libraries clean_opts['input'] = _input @@ -225,6 +226,16 @@ def check_options(options): return clean_opts +def append_period(text): + """ + Append a period to the incoming text if required + """ + + if text[-1] != '.': + text += '.' + + return text + def check_libraries(options): """Build a dict of the libraries that were requested for this batch""" @@ -452,6 +463,7 @@ def add_publisher(record, options): """ publisher = options['publisher'] + munge_publisher = False need_publisher = True need_relator = True @@ -471,7 +483,7 @@ def add_publisher(record, options): # Iterate through all of the existing 710 fields for sten in record.get_fields('710'): for pub in sten.get_subfields('a'): - if pub == publisher or (pub == publisher + '.'): + if pub == publisher: munge_publisher = True for rel in sten.get_subfields('4'): if rel == 'pbl': @@ -482,10 +494,6 @@ def add_publisher(record, options): sten.add_subfield('4', 'pbl') need_publisher = False - # Append a period to the publisher name - if publisher[-1] != '.': - publisher += '.' - if need_publisher: # Add the publisher, with relator code seven_ten = pymarc.Field(tag = '710', @@ -517,10 +525,6 @@ def add_platform(record, options): if pub == platform or (pub == platform + '.'): need_platform = False - # Append a period to the publisher name - if platform[-1] != '.': - platform += '.' - if need_platform: # Add the platform seven_ten = pymarc.Field(tag = '710',