Example #1
0
 def get(self,entrytype,blogId):
     blog = Weblog.get_by_id(int(blogId))
     template_values = {
     'blog': blog,
     'action': "deleteBlog",
     }
     self.generate('blog_delete.html',template_values)
Example #2
0
File: blog.py Project: honten/diary
 def post(self,entrytype,blogId):
   blog= Weblog.get_by_id(int(blogId))
   if(blog is not None):
       blogReactions = blog.weblogreactions_set
       for reaction in blogReactions:
           reaction.delete()
       blog.delete()
       util.flushBlogMonthCache(blog)
       util.flushBlogPagesCache()
   self.redirect('/')
Example #3
0
File: blog.py Project: sadao/blog
  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()
    # [Add] not login is no add reaction
    if not user:
        self.redirect('/'+blog.relative_permalink())
        return

    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
Example #4
0
File: blog.py Project: honten/diary
 def post(self,entrytype,blogId):
     blog= Weblog.get_by_id(int(blogId))
     if(blog is None):
         self.redirect('/')
     if blog.entrytype == 'page':
         blog.permalink = self.request.get('permalink') 
     blog.title = self.request.get('title_input')
     blog.content = self.request.get('text_input')
     blog.tags_commas = self.request.get('tags')
     user = users.get_current_user()
     blog.lastModifiedDate = datetime.datetime.now()
     blog.lastModifiedBy = user
     blog.update()
     util.flushBlogMonthCache(blog)
     util.flushBlogPagesCache()
     self.redirect('/'+blog.relative_permalink())