def _create_marc(self, records_xml): """Creates MARC from MARCXML. @param records_xml: MARCXML containing information about the records @return: string containing information about the records in MARC format """ aleph_marc_output = "" records = bibrecord.create_records(records_xml) for (record, status_code, list_of_errors) in records: sysno_options = {"text-marc": 1} sysno = xmlmarc2textmarc.get_sysno_from_record( record, sysno_options) options = { "aleph-marc": 0, "correct-mode": 1, "append-mode": 0, "delete-mode": 0, "insert-mode": 0, "replace-mode": 0, "text-marc": 1 } aleph_record = xmlmarc2textmarc.create_marc_record( record, sysno, options) aleph_marc_output += aleph_record return aleph_marc_output
def transform_record_to_marc(record, options={'text-marc':1, 'aleph-marc':0}): """ This function will transform a given bibrec record into marc using methods from xmlmarc2textmarc in invenio.utils.text. The function returns the record as a MARC string. @param record: bibrec structure for record to transform @type record: dict @param options: dictionary describing type of MARC record. Defaults to textmarc. @type options: dict @return resulting MARC record as string """ sysno = get_sysno_from_record(record, options) # Note: Record dict is copied as create_marc_record() perform deletions return create_marc_record(record.copy(), sysno, options)
def _create_marc(self, records_xml): """Creates MARC from MARCXML. @param records_xml: MARCXML containing information about the records @return: string containing information about the records in MARC format """ aleph_marc_output = "" records = bibrecord.create_records(records_xml) for (record, status_code, list_of_errors) in records: sysno_options = {"text-marc":1} sysno = xmlmarc2textmarc.get_sysno_from_record(record, sysno_options) options = {"aleph-marc":0, "correct-mode":1, "append-mode":0, "delete-mode":0, "insert-mode":0, "replace-mode":0, "text-marc":1} aleph_record = xmlmarc2textmarc.create_marc_record(record, sysno, options) aleph_marc_output += aleph_record return aleph_marc_output