def format_element(bfo, us="yes"): """Return either a date in 961__x or the date of record creation. @param bfo: BibFormatObject for current record @type nfo: object @return: string of formatted date, or None of no date is found. """ date = bfo.field("961__x").strip() if not date: return bfe_creation_date.format_element(bfo) return date
def get_latest_deposits(): NUMBER_OF_RECORDS = 4; ids = perform_request_search(of="id", rg=NUMBER_OF_RECORDS, sf="005", so="a") limit_ids = ids[:NUMBER_OF_RECORDS] bfo_list = [bibformat_engine.BibFormatObject(id) for id in limit_ids] recs = [{ "id": bfo.recID, "date": bfe_creation_date.format_element(bfo), "author": bfe_authors.format_element(bfo, "1"), "title": bfe_title.format_element(bfo), "description": bfe_abstract.format_element(bfo, prefix_en="", prefix_fr="", suffix_en="", suffix_fr="", limit="", max_chars="72", extension_en="...", extension_fr="..."), "category": bfo.field("980__a"), } for bfo in bfo_list] return recs
def get_latest_deposits(): NUMBER_OF_RECORDS = 4; ids = perform_request_search(of="id", rg=NUMBER_OF_RECORDS, sf="005", so="d") limit_ids = ids[:NUMBER_OF_RECORDS] bfo_list = [bibformat_engine.BibFormatObject(id) for id in limit_ids] recs = [{ "id": bfo.recID, "date": bfe_creation_date.format_element(bfo), "author": bfe_authors.format_element(bfo, "1"), "title": bfe_title.format_element(bfo), "description": bfe_abstract.format_element(bfo, prefix_en="", prefix_fr="", suffix_en="", suffix_fr="", limit="", max_chars="72", extension_en="...", extension_fr="..."), "category": bfo.field("980__a"), } for bfo in bfo_list] return recs