Beispiel #1
0
 def get_timeline_events(self, req, start, stop, filters):
     if "blog" in filters:
         blog_realm = Resource("blog")
         if not "BLOG_VIEW" in req.perm(blog_realm):
             return
         add_stylesheet(req, "tracfullblog/css/fullblog.css")
         # Blog posts
         blog_posts = get_blog_posts(self.env, from_dt=start, to_dt=stop, all_versions=True)
         for name, version, time, author, title, body, category_list in blog_posts:
             bp_resource = blog_realm(id=name, version=version)
             if "BLOG_VIEW" not in req.perm(bp_resource):
                 continue
             bp = BlogPost(self.env, name, version=version)
             yield ("blog", bp.version_time, bp.version_author, (bp_resource, bp, None))
         # Attachments (will be rendered by attachment module)
         for event in AttachmentModule(self.env).get_timeline_events(req, blog_realm, start, stop):
             yield event
         # Blog comments
         blog_comments = get_blog_comments(self.env, from_dt=start, to_dt=stop)
         blog_comments = sorted(blog_comments, key=itemgetter(4), reverse=True)
         for post_name, number, comment, author, time in blog_comments:
             bp_resource = blog_realm(id=post_name)
             if "BLOG_VIEW" not in req.perm(bp_resource):
                 continue
             bp = BlogPost(self.env, post_name)
             bc = BlogComment(self.env, post_name, number=number)
             yield ("blog", time, author, (bp_resource, bp, bc))
Beispiel #2
0
 def get_comments(self):
     """ Returns a list of used comment numbers attached to the post.
     It instantiates BlogComment objects for comments attached to the
     current BlogPost, and returns them in a list sorted by number. """
     comments = sorted(get_blog_comments(self.env, post_name=self.name),
                 key=itemgetter(1))
     return [BlogComment(self.env, comment[0],
                     comment[1]) for comment in comments]
Beispiel #3
0
 def get_comments(self):
     """ Returns a list of used comment numbers attached to the post.
     It instantiates BlogComment objects for comments attached to the
     current BlogPost, and returns them in a list sorted by number. """
     comments = sorted(get_blog_comments(self.env, post_name=self.name),
                       key=itemgetter(1))
     return [
         BlogComment(self.env, comment[0], comment[1])
         for comment in comments
     ]
Beispiel #4
0
 def get_timeline_events(self, req, start, stop, filters):
     if 'blog' in filters:
         blog_realm = Resource('blog')
         if not 'BLOG_VIEW' in req.perm(blog_realm):
             return
         add_stylesheet(req, 'tracfullblog/css/fullblog.css')
         # Blog posts
         blog_posts = get_blog_posts(self.env,
                                     from_dt=start,
                                     to_dt=stop,
                                     all_versions=True)
         for name, version, time, author, title, body, category_list \
                 in blog_posts:
             bp_resource = blog_realm(id=name, version=version)
             if 'BLOG_VIEW' not in req.perm(bp_resource):
                 continue
             bp = BlogPost(self.env, name, version=version)
             yield ('blog', bp.version_time, bp.version_author,
                    (bp_resource, bp, None))
         # Attachments (will be rendered by attachment module)
         for event in AttachmentModule(self.env).get_timeline_events(
                 req, blog_realm, start, stop):
             yield event
         # Blog comments
         blog_comments = get_blog_comments(self.env,
                                           from_dt=start,
                                           to_dt=stop)
         blog_comments = sorted(blog_comments,
                                key=itemgetter(4),
                                reverse=True)
         for post_name, number, comment, author, time in blog_comments:
             bp_resource = blog_realm(id=post_name)
             if 'BLOG_VIEW' not in req.perm(bp_resource):
                 continue
             bp = BlogPost(self.env, post_name)
             bc = BlogComment(self.env, post_name, number=number)
             yield ('blog', time, author, (bp_resource, bp, bc))