예제 #1
0
파일: views.py 프로젝트: aaccomazzi/adsabs
def tab_list(bibcode, list_type):

    solrdoc = get_document(bibcode)

    denormdoc = denormalize_solr_doc(solrdoc)
    graphics = {}
    if list_type != 'graphics':
        #if there are no references return a 404
        if not solrdoc or not solrdoc.has_assoc_list(list_type):
            abort(404)
        #parse the get options 
        query_components = QueryBuilderSimple.build(request.values, list_type=list_type)

        # use the appropriate getter method
        list_method = getattr(solrdoc, "get_%s" % list_type)
        if not list_method:
            abort(404)

        #get the list of associated docs
        resp = list_method(**query_components)
    else:
        resp = {}
        # get article graphics info
        graphics = get_thumbnails(bibcode)
    # log the request
    abstract_view_signal.send(abs_blueprint, bibcode=bibcode, list_type=list_type)
    statsd.incr("abs.%s.viewed" % list_type)
    
    return render_template('abstract_tabs.html', solrdoc=solrdoc, denormdoc=denormdoc, curview=list_type, article_list=resp, graphics=graphics)
예제 #2
0
파일: views.py 프로젝트: aaccomazzi/adsabs
def abstract(bibcode=None):
    
    if bibcode is None:
        abort(404)
        
    solrdoc = get_document(bibcode)
    if not solrdoc:
        abort(404)
    denormdoc = denormalize_solr_doc(solrdoc)

    # get article graphics info
    graphics = get_thumbnails(bibcode)
    # log the request
    abstract_view_signal.send(abs_blueprint, bibcode=bibcode, list_type="abstract")
    statsd.incr("abs.abstract.viewed")
    
    return render_template('abstract_tabs.html', solrdoc=solrdoc, denormdoc=denormdoc, graphics=graphics, curview='abstract')