def _create_date_links(self, post): if "dates" not in self.links: self.links["dates"] = {} datetuple = post.get_datetime().timetuple() date_dict = self.links["dates"] if datetuple[0] not in date_dict: date_dict[datetuple[0]] = {} month = date_prop.num_to_month(datetuple[1]) if month not in date_dict[datetuple[0]]: date_dict[datetuple[0]][month] = [] date_dict[datetuple[0]][month].append(post.post_id)
def sort_posts(self): self.posts.sort(key = lambda post: post.get_datetime().timetuple()) self.posts.reverse()