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)
def tab_list(bibcode, list_type): solrdoc = get_document(bibcode) # if there are no references return a 404 if not solrdoc or not solrdoc.has_assoc_list(list_type): abort(404) denormdoc = denormalize_solr_doc(solrdoc) # 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) # 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 )
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 abstract(bibcode=None): if bibcode is None: abort(404) solrdoc = get_document(bibcode) if not solrdoc: abort(404) denormdoc = denormalize_solr_doc(solrdoc) # 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, curview="abstract")
def url_for_sciencewise(bibcode): """Creates an url for sciencewise""" solrdoc = solr.get_document(bibcode) if not solrdoc: abort(404) ids = solrdoc.getattr_func("ids_data", field_to_json) arxiv_id = [] if ids: for id_ in ids: if id_.get("description") == "arXiv": arxiv_id.append(id_.get("identifier")) if arxiv_id: return "http://sciencewise.info/bookmarks/%s/add" % quote_url(arxiv_id[0].strip("arXiv:")) else: abort(404)
def url_for_linkedin(bibcode): """Creates an url for linkedin""" solrdoc = solr.get_document(bibcode) if not solrdoc: abort(404) if solrdoc.author: message = "%s: " % solrdoc.author[0] else: message = "" if solrdoc.title: message = "%s%s" % (message, solrdoc.title[0]) params = "mini=true&url=%s&title=%s&source=The SAO/NASA Astrophysics Data System" % ( quote_url("%s%s" % (config.MAIL_CONTENT_REDIRECT_BASE_URL, url_for("abs.abstract", bibcode=bibcode))), quote_url(message), ) return "http://www.linkedin.com/shareArticle?%s" % params
def url_for_twitter(bibcode): """Creates an url for twitter""" solrdoc = solr.get_document(bibcode) if not solrdoc: abort(404) if solrdoc.author: status = "%s: " % solrdoc.author[0] else: status = "" if solrdoc.title: status = "%s%s %s via @adsabs" % ( status, solrdoc.title[0], "%s%s" % (config.MAIL_CONTENT_REDIRECT_BASE_URL, url_for("abs.abstract", bibcode=bibcode)), ) return "http://twitter.com/home/?status=%s" % quote_url(status)
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')