def create_edit(self,page,content): """makes new edit in db and updates memcache""" logging.info('CREATE_EDIT') e = WikiEdit.create(page, content) created = e.created old_cache = memcache.get(page + 'edits') or [] memcache.set(page + 'edits',old_cache.append((content,created)))
def get(self,page): logging.info('history.get()') edits = WikiEdit.by_page(page) color = self.white_grey() n = len(edits) edit_info = [(n-i,e.created,e.content,color.next()) for i,e in enumerate(edits)] logging.info('edits are %s' %edit_info) self.render('wiki_history.html', page=page, edits=edit_info, in_out=self.in_out)
def get_page_edits(self,page): return memcache.get(page + 'edits') or WikiEdit.by_page(page)