Show MarcXML version of changes

This commit is contained in:
Adrian Moennich 2014-11-10 10:52:01 +01:00
parent dd6b8b3b21
commit 28afb877c6

View File

@ -19,7 +19,7 @@ from __future__ import unicode_literals
from indico.core.db import db
from indico.util.console import cformat
from indico_livesync import LiveSyncAgentBase, SimpleChange, process_records
from indico_livesync import LiveSyncAgentBase, SimpleChange, MARCXMLGenerator, process_records
from indico_livesync.util import obj_deref
@ -35,6 +35,10 @@ class LiveSyncDebugAgent(LiveSyncAgentBase):
def run(self):
records = self.fetch_records()
if not records:
print cformat('%{yellow!}No records%{reset}')
return
print cformat('%{white!}Raw changes:%{reset}')
for record in records:
print record
@ -45,6 +49,10 @@ class LiveSyncDebugAgent(LiveSyncAgentBase):
obj = obj_deref(ref)
print cformat('%{white!}{}%{reset}: {}').format(_change_str(change), obj or ref)
print
print cformat('%{white!}Resulting MarcXML:%{reset}')
print MARCXMLGenerator.records_to_xml(records)
for record in records:
record.processed = True
db.session.commit()