Skip to content

Commit

Permalink
[#1] Be om bekreftelse hvis post er lenket til CZ
Browse files Browse the repository at this point in the history
  • Loading branch information
danmichaelo committed May 6, 2016
1 parent 75c44d7 commit 8d6f439
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lokar.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def __init__(self, alma, doc):
self.doc = doc
self.mms_id = self.doc.findtext('mms_id')
self.marc_record = self.doc.find('record')
self.linked_to_cz = self.doc.findtext('linked_record_id[@type="CZ"]') or None

def remove_duplicate_fields(self, vocabulary, term, tags):
strenger = []
Expand Down Expand Up @@ -178,6 +179,13 @@ def remove_subject(self, vocabulary, term, tags):
return self # for chaining

def save(self):
if self.linked_to_cz:
logger.info(' -> OBS! Posten er koblet til CZ! Koblingen blir brutt hvis du oppdaterer posten!')
if yesno('Vil du fortsette allikevel?', default='no'):
logger.info(' -> Hopper over denne posten')
return
logger.info(' -> Oppdaterer posten. Koblingen til CZ blir brutt.')

try:
self.alma.put('/bibs/{}'.format(self.mms_id),
data=etree.tostring(self.doc),
Expand Down

0 comments on commit 8d6f439

Please sign in to comment.