Пример #1
0
 def post(self):
     parentComment = db.get(self.request.get('commentKey'))
     commentBody = self.request.get('commentBody')
     commentBody = misc.cleanHtml(commentBody)
     comment = Comment(author=users.get_current_user(),body=self.request.get('commentBody'),date=datetime.datetime.now().date(),_parent=parentComment,article=parentComment.article.key())
     comment.put()
     parentComment.children.append(comment.key())
     parentComment.put()
     memcache.set(str(parentComment.key()),parentComment)
     memcache.delete("publicArticles")
     memcache.delete("allArticles")
     self.redirect('/article?id='+str(comment.article.id))
Пример #2
0
 def post(self):
     comment = db.get(self.request.get('commentKey'))
     if(comment.author == users.get_current_user()):
         commentBody = self.request.get('commentBody')
         try:
             commentBody = misc.cleanHtml(commentBody)
             comment.body = commentBody
             comment.put()
             memcache.set(str(comment.key()), comment)
         except:
             self.redirect('/article?id='+str(comment.article.id))
             return
     self.redirect('/article?id='+str(comment.article.id))
Пример #3
0
 def post(self):
     article = db.get(self.request.get('key'))
     commentBody = self.request.get('commentBody')
     try:
         commentBody = misc.cleanHtml(commentBody)
         comment = Comment(author=users.get_current_user(),body=commentBody,date=datetime.datetime.now().date(),article=article.key())
     except:
         self.redirect('/article?id='+str(article.id))
         return
     comment.put()
     memcache.set(str(comment.key()),comment)
     article.comments.append(comment.key())
     article.put()
     memcache.set("article"+str(article.id),article)
     memcache.delete("publicArticles")
     memcache.delete("allArticles")
     self.redirect('/article?id='+str(article.id))