Exemple #1
0
def home(trending=False):
    """
    If not trending we order by creation date
    """
    trending = True if request.args.get('trending') else False
    subreddits = get_subreddits()
    thread_paginator = process_thread_paginator(trending)

    return render_template('home.html', user=g.user,
            subreddits=subreddits, cur_subreddit=home_subreddit(),
            thread_paginator=thread_paginator)
Exemple #2
0
def permalink(subreddit_name=""):
    """
    """
    subreddit = Subreddit.query.filter_by(name=subreddit_name).first()
    if not subreddit:
        abort(404)

    trending = True if request.args.get('trending') else False
    thread_paginator = process_thread_paginator(trending=trending, subreddit=subreddit)
    subreddits = get_subreddits()

    return render_template('home.html', user=g.user, thread_paginator=thread_paginator,
        subreddits=subreddits, cur_subreddit=subreddit)
Exemple #3
0
def home(trending=False):
    """
    If not trending we order by creation date
    """
    trending = True if request.args.get('trending') else False
    subreddits = get_subreddits()
    thread_paginator = process_thread_paginator(trending)

    return render_template('home.html',
                           user=g.user,
                           subreddits=subreddits,
                           cur_subreddit=home_subreddit(),
                           thread_paginator=thread_paginator)
Exemple #4
0
def search():
    """
    Allows users to search threads and comments
    """
    query = request.args.get('query')
    rs = search_module.search(query, orderby='creation', search_title=True,
            search_text=True, limit=100)

    thread_paginator = process_thread_paginator(rs=rs)
    rs = rs.all()
    num_searches = len(rs)
    subreddits = get_subreddits()

    return render_template('home.html', user=g.user,
            subreddits=subreddits, cur_subreddit=home_subreddit(),
            thread_paginator=thread_paginator, num_searches=num_searches)
Exemple #5
0
def search():
    """
    Allows users to search threads and comments
    """
    query = request.args.get('query')
    rs = search_module.search(query,
                              orderby='creation',
                              search_title=True,
                              search_text=True,
                              limit=100)

    thread_paginator = process_thread_paginator(rs=rs)
    rs = rs.all()
    num_searches = len(rs)
    subreddits = get_subreddits()

    return render_template('home.html',
                           user=g.user,
                           subreddits=subreddits,
                           cur_subreddit=home_subreddit(),
                           thread_paginator=thread_paginator,
                           num_searches=num_searches)