mirror of
https://github.com/lucaspalomodevelop/indico-plugins.git
synced 2026-03-12 23:27:22 +00:00
Show MarcXML version of changes
This commit is contained in:
parent
dd6b8b3b21
commit
28afb877c6
@ -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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user