def cli_main(options, args):
    if options.help or not args:
        usage()
        return

    if options.kb_journals:
        kbs_files = {'journals': options.kb_journals}
    else:
        kbs_files = {}

    kb = get_kbs(custom_kbs_files=kbs_files)['journals']

    out_records = []
    for path in args:
        f = open(path)
        try:
            xml = f.read()
        finally:
            f.close()

        out_records += convert_journals_list(kb, create_records(xml))

    write_records(options, out_records)
Beispiel #2
0
def cli_main(options, args):
    if options.help or not args:
        usage()
        return

    if options.kb_journals:
        kbs_files = {'journals': options.kb_journals}
    else:
        kbs_files = {}

    kb = get_kbs(custom_kbs_files=kbs_files)['journals']

    out_records = []
    for path in args:
        f = open(path)
        try:
            xml = f.read()
        finally:
            f.close()

        out_records += convert_journals_list(kb, create_records(xml))

    write_records(options, out_records)
 def test_create_records(self):
     xml = '\n'.join(self.xml_cache.itervalues())
     records = create_records(xml)
     for record in self.records_cache.itervalues():
         self.assertEqual(record, records.pop(0))
Beispiel #4
0
 def test_create_records(self):
     xml = '\n'.join(self.xml_cache.itervalues())
     records = create_records(xml)
     for record in self.records_cache.itervalues():
         self.assertEqual(record, records.pop(0))