handle no 001 present
parent
f7b796c6a6
commit
d7edd8ee6a
|
@ -85,9 +85,12 @@ class MARCRecord(models.Model):
|
||||||
self.guts = ''
|
self.guts = ''
|
||||||
super(MARCRecord, self).save(*args, **kwargs)
|
super(MARCRecord, self).save(*args, **kwargs)
|
||||||
self.guts = _xml(self._the_record)
|
self.guts = _xml(self._the_record)
|
||||||
field001 = self._the_record.get_fields('001')[0]
|
try:
|
||||||
if field001:
|
field001 = self._the_record.get_fields('001')[0]
|
||||||
self._the_record.remove_field(field001)
|
if field001:
|
||||||
|
self._the_record.remove_field(field001)
|
||||||
|
except IndexError:
|
||||||
|
pass
|
||||||
field001 = pymarc.Field(tag='001', data=self.accession)
|
field001 = pymarc.Field(tag='001', data=self.accession)
|
||||||
self._the_record.add_ordered_field(field001)
|
self._the_record.add_ordered_field(field001)
|
||||||
super(MARCRecord, self).save(*args, **kwargs)
|
super(MARCRecord, self).save(*args, **kwargs)
|
||||||
|
|
Loading…
Reference in New Issue