[Zope3-checkins] CVS: Products3/bugtracker - tracker.py:1.3
Stephan Richter
srichter@cosmos.phy.tufts.edu
Sat, 26 Jul 2003 16:14:04 -0400
Update of /cvs-repository/Products3/bugtracker
In directory cvs.zope.org:/tmp/cvs-serv13068
Modified Files:
tracker.py
Log Message:
It was just too annoying not to get the bugs sorted by string value and not
in the numerical order. So I fixed that. I wonder whether it would be better
to implement our own container and only allow numerical ids.
=== Products3/bugtracker/tracker.py 1.2 => 1.3 ===
--- Products3/bugtracker/tracker.py:1.2 Sat Jul 26 09:40:43 2003
+++ Products3/bugtracker/tracker.py Sat Jul 26 16:13:30 2003
@@ -38,3 +38,16 @@
# See zopeproducts.bugtracker.interfaces.IBugTracker
title = property(getTitle, setTitle)
+
+ def items(self):
+ items = list(super(BugTracker, self).items())
+ items.sort(compare)
+ return items
+
+
+def compare(obj1, obj2):
+ try:
+ return cmp(int(obj1[0]), int(obj2[0]))
+ except ValueError:
+ return cmp(obj1[0], obj2[0])
+