Exemple #1
0
    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))
Exemple #2
0
    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/')
Exemple #3
0
    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))
Exemple #4
0
 def get(self,key_name):
     
     page = PageModel.get_by_key_name(key_name, parent=None)
     self.response.out.write(simplejson.dumps([page.to_dict()]))
Exemple #5
0
    def get(self, key_name):

        page = PageModel.get_by_key_name(key_name, parent=None)
        db.delete(page)

        self.redirect('/')