def post(): if not 'username' in session: main_user = "" return redirect("login/") else: post_dic = reader.make_postdic("data/posts/posts.csv") #post_dic = checker.reformat(post_dic) return render_template("post.html",dic = post_dic,tags = reader.get_tags(post_dic),message = "All Posts",globe=globe)
def post_by_user(usr): user_list = reader.make_dic(reader.read_file("data/users/user_auth.csv")) if not usr in user_list.keys(): return render_template("error.html",error = "The username you have provided does not exist.",globe=globe) post_dic = reader.make_postdic("data/posts/posts.csv") post_dic_user = reader.get_post_by_user(post_dic,usr) return render_template("post.html",dic = post_dic_user,tags = reader.get_tags(post_dic_user),message = "Posts by " + usr,globe=globe)
def post_by_tag(tag): post_dic = reader.make_postdic("data/posts/posts.csv") tags = reader.get_post_by_tag(post_dic,tag) #print "TAGS: " + str(tags) post_dic_tags = [] for i in tags: #print "POST_TAGS: " + str(tags[i]) post_dic_tags.append(post_dic[i]) return render_template("post.html",dic = post_dic_tags,tags = reader.get_tags(post_dic_tags),message = "Posts by tag: " + tag,globe=globe)
def tag_list(): post_dic = reader.make_postdic("data/posts/posts.csv") tag_list = reader.make_taglist(post_dic) return render_template("tags.html",tags = tag_list,globe=globe)