def get(self, key_name): user = authenticatedUser(sessions.Session()) page = PageModel.get_by_key_name(key_name,parent=None) template_values = { 'menulinks': menuLinks(), 'user': user, 'page': page, } path = os.path.join(os.path.dirname(__file__), 'editPage.html') self.response.out.write(template.render(path, template_values))
def post(self,key_name): if authenticatedUser(sessions.Session()): page = PageModel.get_by_key_name(key_name,parent=None) page.key_name = self.request.get('title').replace(' ','_') page.title = self.request.get('title') page.updated = DateTimeProperty.now() page.content = self.request.get('content') page.put(); self.redirect('/') else: self.redirect('/login/')
def get(self,key_name): page = PageModel.get_by_key_name(key_name, parent=None) user = authenticatedUser(sessions.Session()) template_values = { 'menulinks': menuLinks(), 'page': page, 'user': user, 'key_name': key_name, } if (page): path = os.path.join(os.path.dirname(__file__), 'page.html') self.response.out.write(template.render(path, template_values)) else: self.error(404)#('/'+key_name[:len(key_name)]) path = os.path.join(os.path.dirname(__file__), '404.html') self.response.out.write(template.render(path, template_values))
def get(self,key_name): page = PageModel.get_by_key_name(key_name, parent=None) self.response.out.write(simplejson.dumps([page.to_dict()]))
def get(self, key_name): page = PageModel.get_by_key_name(key_name, parent=None) db.delete(page) self.redirect('/')