Beispiel #1
0
def dynlinks(bib_keys, options):
    # for backward-compatibility
    if options.get("details", "").lower() == "true":
        options["jscmd"] = "details"

    try:
        result = query_docs(bib_keys)
        result = process_result(result, options.get('jscmd'))
    except:
        print("Error in processing Books API", file=sys.stderr)
        register_exception()

        result = {}
    return format_result(result, options)
Beispiel #2
0
def dynlinks(bib_keys, options):
    # for backward-compatibility
    if options.get("details", "").lower() == "true":
        options["jscmd"] = "details"
    
    try:    
        result = query_docs(bib_keys)
        result = process_result(result, options.get('jscmd'))
    except:
        print >> sys.stderr, "Error in processing Books API"
        register_exception()
        
        result = {}
    return format_result(result, options)
Beispiel #3
0
def readlinks(req, options):
    try:
        dbstr = 'debug|'
        if req.startswith(dbstr):
            options = {
                'stats': True,
                'show_exception': True,
                'no_data': True,
                'no_details': True,
                'show_all_items': True
            }
            req = req[len(dbstr):]
        rp = ReadProcessor(options)

        if options.get('listofworks'):
            """ For load-testing, handle a special syntax """
            wids = req.split('|')
            mapping = get_eids_for_wids(wids[:5])
            req = '|'.join(('olid:' + k) for k in mapping.values())

        result = rp.process(req)

        if options.get('stats'):
            summary = stats.stats_summary()
            s = {}
            result['stats'] = s
            s['summary'] = summary
            s['stats'] = web.ctx.get('stats', [])
    except:
        print >> sys.stderr, 'Error in processing Read API'
        if options.get('show_exception'):
            register_exception()
            result = {'success': False}
        else:
            register_exception()
        result = {}
    return result