def test_get_article_page_from_cache(self):
     """webjournal - gets an article view of a journal from cache"""
     value = wju.get_article_page_from_cache('AtlantisTimes', 'News', 103,
                                             '03/2009', 'en')
     assert (
         "April 14th, 1832.—Leaving Socêgo, we rode to another estate on the Rio Macâe"
         in value)
            redirect_to_url(req, "%s/journal/%s/%s/%s?ln=%s" % \
                            (CFG_SITE_URL,
                             journal_name,
                             current_issue.split('/')[1],
                             current_issue.split('/')[0],
                             ln))

    try:
        index_page_template = get_journal_template('detailed',
                                                   journal_name,
                                                   ln)
    except InvenioWebJournalTemplateNotFoundError, e:
        register_exception(req=req)
        return e.user_box()

    cached_html = get_article_page_from_cache(journal_name, category,
                                              recid, issue_number, ln)

    if cached_html and not editor:
        return cached_html

    # Check that this recid is indeed an article
    is_article = False
    articles = get_journal_articles(journal_name, issue_number, category)
    for order, recids in articles.iteritems():
        if recid in recids:
            is_article = True
            break

    if not is_article:
        redirect_to_url(req, "%s/journal/%s/%s/%s?ln=%s" % \
                        (CFG_SITE_URL,
Example #3
0
                "%s/journal/%s/%s/%s?ln=%s"
                % (CFG_SITE_URL, journal_name, current_issue.split("/")[1], current_issue.split("/")[0], ln),
            )

    try:
        index_page_template = get_journal_template("detailed", journal_name, ln)
    except InvenioWebJournalTemplateNotFoundError, e:
        register_exception(req=req)
        return e.user_box(req)

    user_info = collect_user_info(req)
    bfo = BibFormatObject(recid, ln=ln, user_info=user_info)
    bfo.req = req

    # if it is cached, return it
    cached_html = get_article_page_from_cache(journal_name, category, recid, issue_number, ln, bfo)

    if cached_html and not editor:
        return cached_html

    # Check that this recid is indeed an article
    is_article = False
    articles = get_journal_articles(journal_name, issue_number, category)
    for order, recids in articles.iteritems():
        if recid in recids:
            is_article = True
            break

    if not is_article:
        redirect_to_url(
            req,
 def test_get_article_page_from_cache(self):
     """webjournal - gets an article view of a journal from cache"""
     value = wju.get_article_page_from_cache('AtlantisTimes', 'News', 103, '03/2009', 'en')
     assert("April 14th, 1832.—Leaving Socêgo, we rode to another estate on the Rio Macâe" in value)