[Zope-CMF] Sort order of talkback_tree

Sam Brauer sam@webslingerz.com
Fri, 01 Aug 2003 12:34:22 -0400


On my CMF site, I customized the "setup_talkback_tree" script such that 
it sorts by ID (based on the assumption that talkback IDs are based on 
timestamps).

#######################################
# setup_talkback_tree:
#######################################
from ZTUtils import SimpleTreeMaker

tm = SimpleTreeMaker('tb_tree')
def getKids(object):
     replies = object.talkback.getReplies()
     # sort replies by ID ascending (chronological order)
     tmp = []
     for reply in replies:
         tmp.append((reply.getId(), reply))
     tmp.sort()
     return [ x[1] for x in tmp ]

tm.setChildAccess(function=getKids)

tree, rows = tm.cookieTree(tree_root)
rows.pop(0)
return {'root': tree, 'rows': rows}
#######################################



Reverend Matt wrote:
> In the talkback_tree, the comments are in random order.  At first I
> thought I'd done something wrong, but now I see it's the same on the
> CMF site and on the plone site.  Is there any intention to fix this
> problem?  Are there any workarounds?  I'd prefer to sort them
> chronologically.
> 
> 
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF@zope.org
> http://mail.zope.org/mailman/listinfo/zope-cmf
> 
> See http://collector.zope.org/CMF for bug reports and feature requests


-- 
Sam Brauer
Systems Programmer
sam@webslingerZ.com