Exemple #1
0
def tab_list(bibcode, list_type):

    #I get the document
    solrdoc = get_document(bibcode)

    #if there are no references I return a 404
    if not solrdoc or not solrdoc.has_assoc_list(list_type):
        abort(404)

    #I get the additional metadata
    inveniodoc = invenio.get_invenio_metadata(bibcode)

    #I 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)

    #I get the list of associated docs
    resp = list_method(**query_components)
    
    # log the request
    abstract_view_signal.send(abs_blueprint, bibcode=bibcode, type=list_type)
    
    return render_template('abstract_tabs.html', solrdoc=solrdoc, inveniodoc=inveniodoc, curview=list_type, article_list=resp)
Exemple #2
0
def abstract(bibcode):
    
    solrdoc = get_document(bibcode)
    if not solrdoc:
        abort(404)
    inveniodoc = invenio.get_invenio_metadata(bibcode)
    
    # log the request
    abstract_view_signal.send(abs_blueprint, bibcode=bibcode, type="abstract")
    
    return render_template('abstract_tabs.html', solrdoc=solrdoc, inveniodoc=inveniodoc, curview='abstract')
 def test_get_invenio_metadata(self):        
     data_out = {'author': ({'affiliations': [],
                 'emails': [],
                 'name': u'Fake Quest, Cosmo',
                 'native_name': None,
                 'normalized_name': u'Quest, C',
                 'type': 'regular'},),
                 'bibcode': '2314ADS..4305...27Q',
                 'keyword': {'controlled': {}, 'free': []},
                 'title': u"An Artist's View of the Next Generation ADS Digital Library System"}
     self.assertEqual(inv.get_invenio_metadata('2314ADS..4305...27Q').data, data_out)