You are not logged in Log in Join
You are here: Home » Members » rossl » (Superceded - is now in Zope 2.2.x) Allows dtml-in sort to have multiple keys

Log in
Name

Password

 
 

Folder icon (Superceded - is now in Zope 2.2.x) Allows dtml-in sort to have multiple keys

(This is now superceded by a properly written patch which is part of zope 2.2.x so this material is now of archeological interest only!)
Whack the WikiWeb here to discuss the patch

<dtml-in "foo" sort=akey> is really handy as everyone knows.

I needed to sort on multiple fields for an application I have, so I hacked at lib/python/DocumentTemplate/DT_In.py so the following
<dtml-in "foo" sort=akey1,akey2,akey3> 
now appears to work.

This patch for DT-In.py is only VERY lightly tested which is why I'm posting it here. If anyone needs this, please try it - but NOT on a production server.

Please add a comment to the wiki to let me know how you go. If it proves useable, I'd suggest it eventually might be worth considering for a future release since without this patch, if you need multiple keys you have to fake them in your data which is cruel..

I haven't even tried the mapping version code and I suspect that it's unlikely to work, but, in the spirit of opensource, for those of a self destructive urge and strong stomach, here's the diff and the whole DT_In.py

This is highly experimental..PLEASE don't even think about using this unless you're willing to clean up any mess that results. All care, no responsibility.

Note that the new file has the original method renamed as osort_sequence so you can easily revert to normal operation.

 Title   Type   Size   Modified   Status 
 Hacked to allow multikey sorts - use at own risk Edit object File 28 K 2000-04-07 published
 hacked version Edit object Software Release   2000-04-07 published
 ZWiki to discuss a hack to DT_In.py Folder   2000-04-27 published