Ejemplo n.º 1
0
 def post(self,reactionId):
   blogReaction= WeblogReactions.get_by_id(int(reactionId))
   if(blogReaction is not None):
       db.delete(blogReaction)
       util.flushRecentReactions()
   self.redirect('/'+blogReaction.weblog.relative_permalink())
   return
Ejemplo n.º 2
0
 def get(self,reactionId):
     blogReaction = WeblogReactions.get_by_id(int(reactionId))
     template_values = {
     'reaction': blogReaction,
     'action': "deleteBlogReaction",
     }
     self.generate('blog_delete.html',template_values)
Ejemplo n.º 3
0
Archivo: blog.py Proyecto: honten/diary
 def post(self,reactionId):
     blogReaction= WeblogReactions.get_by_id(int(reactionId))
     if(blogReaction is None):
         self.redirect('/')
     blogReaction.content = self.request.get('text_input')
     blogReaction.authorWebsite = self.request.get('website')
     user = users.get_current_user()
     if user is not None:
         blogReaction.lastModifiedBy = user
         blogReaction.authorEmail = str(user.email())
         blogReaction.user = str(user.nickname())
     else:
         blogReaction.authorEmail = self.request.get('mail')
         blogReaction.user = self.request.get('name_input')
     blogReaction.lastModifiedDate = datetime.datetime.now()
     blogReaction.put()
     self.redirect('/'+blogReaction.weblog.relative_permalink())
Ejemplo n.º 4
0
  def post(self):
    blogId_ = self.request.get('blogId')
    blog= Weblog.get_by_id(int(blogId_))
    if(blog is None):
      self.redirect('/')
      return
    blogReaction = WeblogReactions()
    blogReaction.weblog = blog
    blogReaction.content = self.request.get('text_input')
    blogReaction.authorWebsite = self.request.get('website')
    blogReaction.authorEmail = self.request.get('mail')
    blogReaction.user = self.request.get('name_input')

    cpedialog = util.getCPedialog()
    clientIp = self.request.remote_addr
    if(cpedialog.recaptcha_enable):
        challenge = self.request.get('recaptcha_challenge_field')
        response  = self.request.get('recaptcha_response_field')
        cResponse = captcha.submit(
                       challenge,
                       response,
                       cpedialog.recaptcha_private_key,
                       clientIp)
        if not cResponse.is_valid:
            captchahtml = None
            captchahtml = captcha.displayhtml(
                    public_key = cpedialog.recaptcha_public_key,
                    use_ssl = False,
                    error = cResponse.error_code)
            reactions = db.GqlQuery("select * from WeblogReactions where weblog =:1  order by date", blog)
            template_values = {
              'blog': blog,
              'reactions': reactions,
              'blogReaction': blogReaction,
              'captchahtml': captchahtml,
              }
            self.generate('blog_view.html',template_values)
            return True

    user = users.get_current_user()
    if user is not None:
        blogReaction.author = user
        blogReaction.authorEmail = str(user.email())
        blogReaction.user = str(user.nickname())
    blogReaction.userIp = clientIp
    blogReaction.save()
    util.flushRecentReactions()
    self.redirect('/'+blog.relative_permalink())
    return