コード例 #1
0
ファイル: blog.py プロジェクト: CarlosGabaldon/calabro
 def create_comment(self, post_id, name, web_site, email, text):
     
     #sanitize input...
     post = Posts.get(post_id)
     comments = list(post.comments)
     comment = Comments(post=post, name=name, web_site=web_site, email=email, text=text, created=datetime.now())
     comments.append(comment)
     return widgets.comment_widget.render(comment=comment)
コード例 #2
0
ファイル: blog.py プロジェクト: CarlosGabaldon/calabro
 def update_post(self, post_id, title, text, user_id, tags):
     t = datetime.now()
     site=get_current_site()
     user = User.get(user_id)
     post = Posts.get(post_id)
     post.set(title=title,
              text=text,
              user=user,
              updated=t)
     
     tag_list = Tags.parse(tags)
     for tag_name in tag_list:
         tag = Tags.find_or_create(name=tag_name, site=site)
         if tag not in post.tags:
             tag.count = tag.count + 1            
             post.addTags(tag)
                           
     redirect_to_home()
コード例 #3
0
ファイル: blog.py プロジェクト: CarlosGabaldon/calabro
 def comment_count(self, post_id):
     post = Posts.get(post_id)
     return post.number_of_comments();