Exemplo n.º 1
0
def search_all(query, delta):
    #convert delta to int/check if its unicode
    # if its unicode then no time filter was set
    #anticipating an error if delta is passed as None, because no time filter is set
    try:
        delta = int(delta)
        check_delta = True
    except ValueError:
        check_delta = False
    if check_delta:
        # if delta is an int search this way
       results = Posts.search_by_time_delta(Posts.search_all, delta, query)
       flash("searched by time delta")
    else:
        results = Posts.search_all(query)
        flash("searched all posts")
    return render_template('all_results.html', results=results)