def get_bib_records(gen_ids): records = get_records(gen_ids) bib_records = [] for record in records: doc_tree = etree.XML(record.content) bib_tree = xslt_bib_draw_transformer(doc_tree) bib_dump = etree.tostring(bib_tree, encoding='utf-8') bib_records.append({ 'record': record, 'card': beautify(bib_dump.replace('<b/>', '')), }) return bib_records
def get_bib_records(question): bib_ids = [] if question.bib_ids: bib_ids = question.bib_ids.replace(u"\r", '').split("\n") bib_ids = map(lambda x: x.strip(), bib_ids) bib_records = [] if bib_ids: records = get_records(bib_ids) for record in records: doc_tree = etree.XML(record.content) bib_tree = xslt_bib_draw_transformer(doc_tree) bib_dump = etree.tostring(bib_tree, encoding='utf-8') bib_records.append({ 'record': record, 'card': beautify(bib_dump.replace('<b/>', '')), }) return bib_records