Ejemplo n.º 1
0
def article_html_by_aid(article_id):
    article = controllers.get_article_by_aid(article_id)

    if not article:
        abort(404, _(u'Artigo não encontrado'))

    article_html = article.htmls[0].source

    return article_html
Ejemplo n.º 2
0
    def test_get_article_by_aid(self):
        """
        Teste da função controllers.get_article_by_aid para retornar um objeto:
        ``Article``.
        """

        article = self._makeOne()

        self.assertEqual(controllers.get_article_by_aid(article.id).id,
                         article.id)
Ejemplo n.º 3
0
def abstract_detail(article_id):
    article = controllers.get_article_by_aid(article_id)

    if not article:
        abort(404, _(u'Artigo não encontrado'))

    context = {
        'article': article,
        'journal': article.journal,
        'issue': article.issue
    }
    return render_template("article/abstract.html", **context)
Ejemplo n.º 4
0
def article_detail(article_id):
    article = controllers.get_article_by_aid(article_id)

    if not article:
        abort(404, _(u'Artigo não encontrado'))

    if not article.is_public:
        abort(404, _(article.unpublish_reason))

    if not article.issue.is_public:
        abort(404, _(article.issue.unpublish_reason))

    if not article.journal.is_public:
        abort(404, _(article.journal.unpublish_reason))

    context = {
        'article': article,
        'journal': article.journal,
        'issue': article.issue
    }
    return render_template("article/detail.html", **context)
Ejemplo n.º 5
0
 def test_get_article_by_aid_without_article(self):
     """
     Testando controllers.get_article_by_aid() sem article, deve retornar
     None.
     """
     self.assertIsNone(controllers.get_article_by_aid('anyjid'))