def GET(self, post_id): comm_idxs = r.get_list(r.post_key(post_id, "comm.list", raw=True)) comments = [] for cid in comm_idxs: body = r.comm(post_id, cid) date = r.comm_key(post_id, cid, "comm_date") comments.append({"url": cid, "comm_body": body, "comm_date": date}) ctx = {"post_id": post_id, "comments": comments} return {"ctx": ctx}
def GET(self, post_id): comm_idxs = r.get_list(r.post_key(post_id, 'comm.list', raw=True)) comments = [] for cid in comm_idxs: body = r.comm(post_id, cid) date = r.comm_key(post_id, cid, 'comm_date') comments.append({'url': cid, 'comm_body': body, 'comm_date': date}) ctx = {'post_id': post_id, 'comments': comments} return {'ctx': ctx}
def GET(self): num = r.len("post.list") post_idxs = r.get_list("post.list") posts = [] for pid in post_idxs: title = r.post_key(pid, "post_title") date = r.post_key(pid, "post_date") posts.append({"post_title": title, "post_date": date, "url": pid}) ctx = {"num_posts": num, "posts": posts} return {"ctx": ctx}
def GET(self): num = r.len('post.list') post_idxs = r.get_list('post.list') posts = [] for pid in post_idxs: title = r.post_key(pid, 'post_title') date = r.post_key(pid, 'post_date') posts.append({'post_title': title, 'post_date': date, 'url': pid}) ctx = {'num_posts': num, 'posts': posts} return {'ctx': ctx}