Example #1
0
    def get(self):
        
        page = int(self.request.get('page', '0')) 
        
        paginator = ObjectPaginator(db.GqlQuery('SELECT * FROM BlogPostModel ORDER BY created DESC'),10)
        
        blogposts = paginator.get_page(page)
        
        nextPageNumber = 0
        prevPageNumber = 0
        
        if paginator.has_next_page(page):
            nextPageNumber = str(page+1)
        
        if paginator.has_previous_page(page):
            prevPageNumber = str(page-1)
        
        template_values = {
            'menulinks':menuLinks(),
            'blogposts': blogposts,
            'user': authenticatedUser(sessions.Session()),
            'nextPageNumber': nextPageNumber,
            'prevPageNumber': prevPageNumber,
        }

        path = os.path.join(os.path.dirname(__file__), 'news.html')
        self.response.out.write(template.render(path, template_values))
Example #2
0
    def get(self):

        failedLogin = cgi.escape(self.request.get('failed_login'))

        template_values = {
            'menulinks': menuLinks(),
            'failedLoginValue': failedLogin,
        }

        path = os.path.join(os.path.dirname(__file__), 'login.html')
        self.response.out.write(template.render(path, template_values))
Example #3
0
    def get(self):

        user = authenticatedUser(sessions.Session())

        template_values = {
            'menulinks': menuLinks(),
            'user': user,             
        }

        path = os.path.join(os.path.dirname(__file__), 'newPost.html')
        self.response.out.write(template.render(path, template_values))
Example #4
0
    def get(self,garbage):
        
        user = authenticatedUser(sessions.Session())

        template_values = {  
            'menulinks': menuLinks(),
            'user': user,
            'garbage': garbage,          
        }
        
        self.error(404)
        path = os.path.join(os.path.dirname(__file__), '404.html')
        self.response.out.write(template.render(path, template_values))
Example #5
0
    def get(self,id):

        user = authenticatedUser(sessions.Session())
        blogpost = BlogPostModel.get_by_id(int(id), parent=None)

        template_values = {
            'menulinks': menuLinks(),
            'user': user,
            'post': blogpost,          
        }

        path = os.path.join(os.path.dirname(__file__), 'editPost.html')
        self.response.out.write(template.render(path, template_values))
Example #6
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))
Example #7
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))