Ejemplo n.º 1
0
def article():
    url = request.args.get('url')
    article = cached_call(article_reader.get_article, url)
    return render_template('article.html',
                           article=article,
                           with_back=get_with_back(request),
                           back_url=request.args.get('back_url'))
Ejemplo n.º 2
0
def article():
    url = request.args.get('url')
    article = cached_call(article_reader.get_article, url)
    return render_template('article.html',
            article=article,
            with_back=get_with_back(request),
            back_url=request.args.get('back_url'))
Ejemplo n.º 3
0
def topic():
    topic_id = request.args.get('id')
    topic = cached_call(news_browser.fetch_topic, topic_id)
    return render_template('topic.html',
                           topic=topic,
                           with_back=get_with_back(request),
                           back_url=request.args.get('back_url'))
Ejemplo n.º 4
0
def search(query):
    """Respond with a list of search results.
    """
    results = cached_call(news_searcher.search, query=query)
    return render_template('search_results.html', results=results, query=query,
            with_back=get_with_back(request),
            back_url='/')
Ejemplo n.º 5
0
def search(query):
    """Respond with a list of search results.
    """
    results = cached_call(news_searcher.search, query=query)
    return render_template('search_results.html',
                           results=results,
                           query=query,
                           with_back=get_with_back(request),
                           back_url='/')
Ejemplo n.º 6
0
def index():
    """Homepage, list news topics or respond with search results if
    X-Mxit-User-Input is present.
    """
    query = request.form.get('X-Mxit-User-Input')
    if query:
        # The user has submitted a search query.
        return search(query)
    else:
        # The user is requesting the home page.
        topics = news_browser.topics
        return render_template('index.html',
                               topics=topics,
                               debug=True,
                               with_back=get_with_back(request),
                               back_url=request.args.get('back_url'))
Ejemplo n.º 7
0
def index():
    """Homepage, list news topics or respond with search results if
    X-Mxit-User-Input is present.
    """
    query = request.form.get('X-Mxit-User-Input')
    if query:
        # The user has submitted a search query.
        return search(query)
    else:
        # The user is requesting the home page.
        topics = news_browser.topics
        return render_template('index.html',
                topics=topics,
                debug=True,
                with_back=get_with_back(request),
                back_url=request.args.get('back_url'))
Ejemplo n.º 8
0
def topic():
    topic_id = request.args.get('id')
    topic = cached_call(news_browser.fetch_topic, topic_id)
    return render_template('topic.html', topic=topic, with_back=get_with_back(request),
            back_url=request.args.get('back_url'))