def _update_feed_monthly_story_count(feed, new_story_objects): monthly_story_count = MonthlyStoryCount.load( feed.monthly_story_count_data) for story in new_story_objects: if not story.dt_published: continue year, month = story.dt_published.year, story.dt_published.month count = monthly_story_count.get(year, month) monthly_story_count.put(year, month, count + 1) feed.monthly_story_count = monthly_story_count feed.save()
def monthly_story_count(self): return MonthlyStoryCount.load(self.monthly_story_count_data)