def get(self): selectcookie = self.request.cookies.get("sub_selection") if selectcookie: selected = split_subreddit_list(self.request.cookies.get("sub_selection")) else: selected = "" query = Transaction('SubReddits').query() self.render("subselect.html", subquery = query, selected = selected)
def get(self, subreddit_list): limit = self.request.get('limit') timestamp = self.request.get('after') ASCDESC = self.request.get('ascdesc') if timestamp == "": timestamp = 300000000000000000 timestamp = int(timestamp) if ASCDESC == "" or "DESC": order = "-date" else: order = "date" if limit: limit = int(limit) else: limit = 50 subreddits = [] if subreddit_list != "/": subreddits = split_subreddit_list(subreddit_list) else: subcookie = self.request.cookies.get('sub_selection') if subcookie: subreddits = split_subreddit_list(subcookie) else: subreddits = DEFAULTSUBREDDITS query = Cache().cachedQuery('pics', subredditINININ = subreddits, dateSMALLER = timestamp, order = order, limit = limit) if len(query) > 0: lasttimestamp = (query[-1])['date'] firsttimestamp = (query[0])['date'] else: firsttimestamp = lasttimestamp = 300000000000000000 self.render("main.html", pics = query, lasttimestamp = lasttimestamp, firsttimestamp = firsttimestamp, url = subreddit_list)