def comments_sorted(comments, root=None, variant=None): from adhocracy.lib.tiles.comment_tiles import CommentTile comments = [c for c in comments if (c.variant == variant and c.reply == root)] _comments = [] for comment in sorting.comment_order(comments): tile = CommentTile(comment) _comments.append((comment, tile)) return _comments
def comments_sorted(comments, root=None, variant=None): from adhocracy.lib.tiles.comment_tiles import CommentTile comments = [ c for c in comments if (c.variant == variant and c.reply == root) ] _comments = [] for comment in sorting.comment_order(comments): tile = CommentTile(comment) _comments.append((comment, tile)) return _comments
def comments_sorted(comments, root=None, variant=None, key=None, include_deleted=False): from adhocracy.lib.tiles.comment_tiles import CommentTile comments = [c for c in comments if c.reply == root and ((variant is None and c.variant == Text.HEAD) or c.variant == variant)] if not include_deleted: comments = filter(lambda x: not x.is_deleted(), comments) _comments = [] if key is None: comments = sorting.comment_order(comments) else: comments = sorted(comments, key=key) for comment in comments: tile = CommentTile(comment) _comments.append((comment, tile)) return _comments
def comments_sorted(comments, root=None, variant=None, key=None, include_deleted=False): from adhocracy.lib.tiles.comment_tiles import CommentTile comments = [ c for c in comments if c.reply == root and ((variant is None and c.variant == Text.HEAD) or c.variant == variant) ] if not include_deleted: comments = filter(lambda x: not x.is_deleted(), comments) _comments = [] if key is None: comments = sorting.comment_order(comments) else: comments = sorted(comments, key=key) for comment in comments: tile = CommentTile(comment) _comments.append((comment, tile)) return _comments