def post(self,page): if not self.user: redirect_to('wiki_front','/') page = page.strip('/') new_content = self.request.get('content') # get updated content wiki_page = WikiPage.get_page(page) # look for existing wiki page if not wiki_page: # if it's not there.... wiki_page = self.create_wiki_page(page,new_content) self.redirect_to('wiki_page', page=page) else: old_content = self.get_wiki_content(wiki_page) logging.info('new content is %s' %new_content) logging.info('old content is %s' %old_content) if old_content == new_content: # if updated content is not an update at all... logging.info('old==new....%s' %(old_content==new_content)) self.render('wiki_edit.html',content=new_content, edit_button = self.button, error='no changes detected') else: self.update_wiki_page(wiki_page,new_content) logging.info('page = %s' %page) self.redirect_to('wiki_page', page=page)
def get_front(self): return (memcache.get('front') or WikiPage.get_page('front')) or []
def get_wiki_page(self,page): logging.info('get wiki page') wiki_page = memcache.get(page) or WikiPage.get_page(page) logging.info('wiki_page is %s' %wiki_page) return memcache.get(page) or WikiPage.get_page(page)