Ejemplo n.º 1
0
def index():
    """
    Renders the index (home) page with the default News Source
    :return: The rendered index page
    """
    news, header = get_most_read(DEFAULT_NS)
    current_year = datetime.now().year
    contact_form = ContactForm()
    return render_template(
        "ns.html", title=gettext("Home Page"), year=current_year, news=news, header=header, contact_form=contact_form
    )
Ejemplo n.º 2
0
def index():
    """
    Renders the index (home) page with the default News Source
    :return: The rendered index page
    """
    news, header = get_most_read(DEFAULT_NS)
    current_year = datetime.now().year
    contact_form = ContactForm()
    return render_template("ns.html",
                           title=gettext('Home Page'),
                           year=current_year,
                           news=news,
                           header=header,
                           contact_form=contact_form)
Ejemplo n.º 3
0
def ns():
    """
    Gets the most read news from a specific news source
    If the request parameters contains Local information, we fetch data from the Local News Source
    :return: a JSON file with the news list
    """
    p_ns = request.args.get('ns')
    p_state = request.args.get('local')

    if p_state:
        p_ns += p_state  # eg.: localDF, localSP, etc.

    news, header = get_most_read(p_ns)
    d = dict(news=news, header=header)
    j = json.dumps(d)
    return j
Ejemplo n.º 4
0
def ns():
    """
    Gets the most read news from a specific news source
    If the request parameters contains Local information, we fetch data from the Local News Source
    :return: a JSON file with the news list
    """
    p_ns = request.args.get("ns")
    p_state = request.args.get("local")

    if p_state:
        p_ns += p_state  # eg.: localDF, localSP, etc.

    news, header = get_most_read(p_ns)
    d = dict(news=news, header=header)
    j = json.dumps(d)
    return j