Пример #1
0
 def get(self):
     id = self.request.get('id')
     user = users.get_current_user()
     if(id.isdigit()):
         article = misc.getArticle(id)
         if(article == None):
             self.redirect('/')
         elif(article.public):
             
             loggedIn = False
             loginUrl = ""
             if user:
                 loggedIn = True
             else:
                 loginUrl = users.create_login_url(self.request.uri)
             
             template_values = {
                 'article': article,
                 'comments':printComments(article.comments),
                 'loggedin':loggedIn,
                 'loginurl': loginUrl,
                 'key': article.key(),
             }
             path = os.path.join(os.path.dirname(__file__), 'templates/article.html')
             self.response.out.write(template.render(path, template_values))
         else:
             self.redirect('/')
     else:
         self.redirect('/')
Пример #2
0
 def get(self):
     article = misc.getArticle(self.request.get('id'))
     comments = printAdminComments(article.comments)
     template_values = {
         'article': article,
         'key': article.key(),
         'comments': comments,
     }
     path = os.path.join(os.path.dirname(__file__), 'templates/adminarticle.html')
     self.response.out.write(template.render(path, template_values))