Mercurial > p > roundup > code
changeset 2247:7d5398391610
fixes to anydbm filtering
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 04 May 2004 00:16:07 +0000 |
| parents | 9db7d2842222 |
| children | cd7e6d6288c6 |
| files | roundup/backends/back_anydbm.py test/db_test_base.py |
| diffstat | 2 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/roundup/backends/back_anydbm.py Tue May 04 00:02:23 2004 +0000 +++ b/roundup/backends/back_anydbm.py Tue May 04 00:16:07 2004 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -#$Id: back_anydbm.py,v 1.143 2004-04-26 00:46:34 richard Exp $ +#$Id: back_anydbm.py,v 1.144 2004-05-04 00:16:06 richard Exp $ '''This module defines a backend that saves the hyperdatabase in a database chosen by anydbm. It is guaranteed to always be available in python versions >2.1.1 (the dumbdbm fallback in 2.1.1 and earlier has several @@ -1776,11 +1776,12 @@ def sortfun(a, b, directions=directions, n=range(len(directions))): for i in n: if a[i] == b[i]: continue - if directions[i] == '-': + if directions[i] == '+': return cmp(a[i],b[i]) else: return cmp(b[i],a[i]) - return 0 + # for consistency, sort by the id if the items are equal + return cmp(a[-2], b[-2]) matches.sort(sortfun) # pull the id out of the individual entries
--- a/test/db_test_base.py Tue May 04 00:02:23 2004 +0000 +++ b/test/db_test_base.py Tue May 04 00:16:07 2004 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: db_test_base.py,v 1.25 2004-04-18 05:31:02 richard Exp $ +# $Id: db_test_base.py,v 1.26 2004-05-04 00:16:07 richard Exp $ import unittest, os, shutil, errno, imp, sys, time, pprint @@ -813,15 +813,15 @@ iss = self.db.issue for issue in ( {'title': 'issue one', 'status': '2', 'assignedto': '1', - 'foo': date.Interval('1:10'), + 'foo': date.Interval('1:10'), 'deadline': date.Date('2003-01-01.00:00')}, {'title': 'issue two', 'status': '1', 'assignedto': '2', - 'foo': date.Interval('1d'), + 'foo': date.Interval('1d'), 'deadline': date.Date('2003-02-16.22:50')}, {'title': 'issue three', 'status': '1', 'nosy': ['1','2'], 'deadline': date.Date('2003-02-18')}, {'title': 'non four', 'status': '3', - 'foo': date.Interval('0:10'), + 'foo': date.Interval('0:10'), 'nosy': ['1'], 'deadline': date.Date('2004-03-08')}): self.db.issue.create(**issue) self.db.commit()
