def GET(self, post_id): title = r.post_key(post_id, "post_title") body = r.post_key(post_id, "post_body") date = r.post_key(post_id, "post_date") numc = r.len(r.post_key(post_id, "comm.list", raw=True)) ctx = {"post_id": post_id, "post_title": title, "post_body": body, "post_date": date, "numc": numc} 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}
def GET(self, post_id): title = r.post_key(post_id, 'post_title') body = r.post_key(post_id, 'post_body') date = r.post_key(post_id, 'post_date') numc = r.len(r.post_key(post_id, 'comm.list', raw=True)) ctx = { 'post_id': post_id, 'post_title': title, 'post_body': body, 'post_date': date, 'numc': numc } return {'ctx': ctx}