def show_trends(): "show_trends method called" topicid = request.args.get("topic") d, l = get.get_trendTweets(topicid) d1, l1 = get.get_favourite(session["emailid"]) d2 = get.get_retweets(session["emailid"]) return render_template("trends.html", d=d, l=l, f=l1, retweet=d2)
def myfavourites(): user = session["other_user"] val = op.get("USERNAME", user) uid = val["uid"] d, l = get.get_favourite(uid) # session['other_user'] = session['username'] return render_template("favourite.html", d=d, l=l, username=session["username"], other_user=session["other_user"])
def get_userline(): d = {} follow_flag = 0 if "username" not in session or session["username"] is None: return render_template("login.html") if request.method == "GET": if session["username"] != session["other_user"]: follow_flag = users.check_follow(session["other_user"], session["username"]) val = op.get("USERNAME", session["other_user"]) uid = val["uid"] else: uid = session["emailid"] if uid is not None: d, l = get.get_userline(uid) d1, l1 = get.get_favourite(session["emailid"]) d2 = get.get_retweets(session["emailid"]) return render_template( "tweets.html", follow_flag=follow_flag, d=d, l=l, f=l1, username=session["username"], other_user=session["other_user"], retweet=d2, ) else: return render_template("login.html")
def home(): startval = request.args.get("start") startval = int(startval) session["tweet_count"] = get.get_timeline_count(session["emailid"]) session["other_user"] = session["username"] session["other_email"] = session["emailid"] uid = session["emailid"] info = get.get_userinfo(uid) d, l = get.get_timeline(uid) d2 = get.get_retweets(session["emailid"]) d1, l1 = get.get_favourite(session["emailid"]) current_trends = tweets.current_trends() if len(l) > startval + 5: limit = startval + 5 nextt = limit else: limit = len(l) nextt = 0 l = l[startval:limit] if startval == 0: return render_template( "home.html", info=info, d=d, l=l, retweet=d2, f=l1, start=int(nextt), trends=current_trends ) else: return jsonify({"d": d, "l": l, "retweet": d2, "f": l1, "start": nextt, "trends": current_trends})