Ejemplo n.º 1
0
def benchmark():
    """
    Benchmark the module, using profile and pstats
    """
    import profile
    import pstats
    from invenio.bibformat import record_get_xml

    global xmltext

    xmltext = record_get_xml(10, 'oai_dc')
    profile.run('bc_profile()', "bibconvert_xslt_profile")
    p = pstats.Stats("bibconvert_xslt_profile")
    p.strip_dirs().sort_stats("cumulative").print_stats()
Ejemplo n.º 2
0
def print_invenio_xml(bibcodes):
    print '<?xml version="1.0" encoding="UTF-8"?><collection xmlns="http://www.loc.gov/MARC21/slim">'
    for bibcode in bibcodes:
        print '<!-- ################################################################## -->'
        print '<!-- bibcode: %s -->' % bibcode
        ids = run_sql('select id_bibrec from bibrec_bib97x where id_bibxxx = (select id from bib97x where value="%s")'%bibcode)
        if len(ids[0]) == 0:
            print '<!-- bibcode not found in DB -->'
        elif len(ids[0]) > 1:
            print '<!-- too many ids found for the same bibcode -->'
        else:
            xml = record_get_xml(ids[0][0])
            print ''.join([l.strip() for l in xml.splitlines()])
    print '</collection>'