Example #1
0
def search_user():
    page_context = {}
    user = flask_login.current_user
    if user.is_anonymous():
        user = User()
    else:
        if len(user.username.strip()) == 0: return redirect(url_for('signup'))
    if request.method == 'POST' and UPLOADS_FOLDER is not '':
        return process_upload(request)
    if not user.is_anonymous():
        page_context['username'] = user.username
    page_context['id_to_path'] = id_to_path		
    page_context['google_url'] = google_login.authorization_url() 
    page_context['uid'] = user.uid
	
    email = request.args.get('email')
    if email != None and email != '':
        s_user = sql_controller.get_user_by_email(email)
        if s_user != None and s_user != '':
            return redirect(url_for('profile', profileid = s_user.uid))
    posts = sql_controller.tag_search(email, 9)
    return render_template('front.html', posts=posts, page_context = page_context).format(google_login.authorization_url())
Example #2
0
def search_comment():
    page_context = {}
    user = flask_login.current_user
    if user.is_anonymous():
        user = User()
    else:
        if len(user.username.strip()) == 0: return redirect(url_for('signup'))
    if request.method == 'POST' and UPLOADS_FOLDER is not '':
        return process_upload(request)
    tag = request.args.get('tag')
	
    #user = flask_login.current_user
    if not user.is_anonymous():
        page_context['username'] = user.username
    page_context['id_to_path'] = id_to_path		
    page_context['google_url'] = google_login.authorization_url() 
    page_context['uid'] = user.uid
    if tag != None and tag != '':
        posts = sql_controller.tag_search(tag, 9)
        return render_template('front.html', posts=posts, page_context = page_context).format(google_login.authorization_url())
		
    return render_template('front.html', posts=[], page_context = page_context).format(google_login.authorization_url())