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