Exemplo n.º 1
0
def readlink_multiple(bibkey_str, options):
    requests = bibkey_str.split('|')
    # make mapping between maybe-id and key-to-use
    rmap = {}
    for r in requests:
        if r[:3].lower() == 'id:':
            parts = r.split(';')
            if len(parts) != 2:
                return {}
            key = parts[0][3:]
            val = parts[1]
        else:
            key = r
            val = r
        rmap[key] = val
    records = dynlinks.query_docs(rmap.values())
    datas = dynlinks.process_result(records, 'data')
    details = dynlinks.process_result(records, 'details')

    formatted = {}
    for k in records.keys():
        formatted[k] = format_one_request(records[k], datas[k], details[k])

    result = {}
    for k in rmap.keys():
        f = formatted.get(rmap[k], None)
        if f is not None:
            result[k] = f

    return result
Exemplo n.º 2
0
def readlink_multiple(bibkey_str, options):
    requests = bibkey_str.split('|')
    # make mapping between maybe-id and key-to-use
    rmap = {}
    for r in requests:
        if r[:3].lower() == 'id:':
            parts = r.split(';')
            if len(parts) != 2:
                return {}
            key = parts[0][3:]
            val = parts[1]
        else:
            key = r
            val = r
        rmap[key] = val
    records = dynlinks.query_docs(rmap.values())
    datas = dynlinks.process_result(records, 'data')
    details = dynlinks.process_result(records, 'details')

    formatted = {}
    for k in records.keys():
        formatted[k] = format_one_request(records[k], datas[k], details[k])

    result = {}
    for k in rmap.keys():
        f = formatted.get(rmap[k], None)
        if f is not None:
            result[k] = f
    
    return result
Exemplo n.º 3
0
def readlink_single(bibkey, options):
    bka = [bibkey]
    r = dynlinks.query_docs(bka)
    (data, details) = [dynlinks.process_result(r, cmd)[bibkey]
                       for cmd in ('data', 'details')]
    if len(r) == 0:
        return []
    record = r[bibkey]
    return format_one_request(record, data, details)
Exemplo n.º 4
0
def readlink_single(bibkey, options):
    bka = [bibkey]
    r = dynlinks.query_docs(bka)
    (data, details) = [
        dynlinks.process_result(r, cmd)[bibkey] for cmd in ('data', 'details')
    ]
    if len(r) == 0:
        return []
    record = r[bibkey]
    return format_one_request(record, data, details)