def tag(uid): u = User.get(uid) if not u: abort(404, "no such user") count = min(g.count, 50) kws = get_keywords(u.id, count) return ",".join([x[0] for x in kws])
def timeline(): ids = Status.get_ids(user_id=g.user.id, start=g.start, limit=g.count, cate=g.cate) status_list = Status.gets(ids) status_list = statuses_timelize(status_list) if status_list: tags_list = [x[0] for x in get_keywords(g.user.id, 30)] else: tags_list = [] intros = [g.user.get_thirdparty_profile(x).get("intro") for x in config.OPENID_TYPE_DICT.values()] intros = filter(None, intros) return render_template("timeline.html", user=g.user, tags_list=tags_list, intros=intros, status_list=status_list, config=config)
def user(uid): u = User.get(uid) if not u: abort(404, "no such user") if g.user and g.user.id == u.id: return redirect(url_for("timeline")) #TODO:增加可否查看其他用户的权限检查 cate = request.args.get("cate", None) ids = Status.get_ids(user_id=u.id, start=g.start, limit=g.count, cate=g.cate) status_list = Status.gets(ids) status_list = statuses_timelize(status_list) if status_list: tags_list = [x[0] for x in get_keywords(u.id, 30)] else: tags_list = [] intros = [u.get_thirdparty_profile(x).get("intro") for x in config.OPENID_TYPE_DICT.values()] intros = filter(None, intros) return render_template("timeline.html", user=u, unbinded=[], tags_list=tags_list, intros=intros, status_list=status_list, config=config)