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}
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 wrap(*args, **kwargs): if len(args) < 1 or r.has(r.post_key(args[1], "post_date", raw=True)): return f(*args, **kwargs) else: return web.notfound()
def wrap(*args, **kwargs): if len(args) < 1 or r.has(r.post_key(args[1], 'post_date', raw=True)): return f(*args, **kwargs) else: return web.notfound()