dupe_flags = {}
- if files['duplicate']:
+ if 'duplicate' in files:
tmp_record = process_fields(copy.deepcopy(record), options)
bib_id, dupe_flags['isbn'] = isbn_check(tmp_record)
if dupe_flags['isbn']:
tmp_record = add_dupe_field(tmp_record, bib_id)
files['duplicate'].write(tmp_record)
+ else:
+ del(dupe_flags['isbn'])
- if files['tcn']:
+ if 'tcn' in files and len(dupe_flags) == 0:
tmp_record = process_fields(copy.deepcopy(record), options)
bib_id, dupe_flags['tcn'] = tcn_check(tmp_record)
if dupe_flags['tcn']:
tmp_record = add_dupe_field(tmp_record, bib_id)
files['tcn'].write(tmp_record)
+ else:
+ del(dupe_flags['tcn'])
- if files['url']:
+ if 'url' in files and len(dupe_flags) == 0:
tmp_record = process_fields(copy.deepcopy(record), options)
bib_id, dupe_flags['url'] = url_check(tmp_record, options)
if dupe_flags['url']:
tmp_record = add_dupe_field(tmp_record, bib_id)
files['url'].write(tmp_record)
+ else:
+ del(dupe_flags['url'])
if len(dupe_flags):
DUP_COUNT += 1
else:
new_record = process_fields(record, options)
writer.write(new_record)
- if (files['sample'] and (
+ if ('sample' in files and (
(RECORD_COUNT == 1) or (RECORD_COUNT % 100 == 0)
)):
files['sample'].write(new_record)