""" returns a sorted list of blog entries """ # Copyright © 2004 Saugus.net, Inc. # All Rights Reserved. # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. from string import lower from ZTUtils import LazyFilter blogs=[] sortableBlogs=[] for blog in LazyFilter(context.objectValues('News Item'),skip=''): if blog.Type()=='Blog': if (subjectStr=='' or subjectStr in blog.Subject()): print blog.day,blog.id,blog.Description(),blog.html_allowed sortableBlogs.append((blog.day,blog.rank,blog)) if sortableBlogs: sortableBlogs.sort() print sortableBlogs oldDay=0 dayBlog=None for blogTuple in sortableBlogs: print blogTuple[0],oldDay if blogTuple[0]!=oldDay: if dayBlog: blogs.append(dayBlog) oldDay=blogTuple[0] dayBlog=(blogTuple[0],[]) dayBlog[1].append(blogTuple[2]) print blogs #return blogs return printed