comparison roundup/hyperdb.py @ 86:b89712288636

just some comments
author Richard Jones <richard@users.sourceforge.net>
date Fri, 27 Jul 2001 05:17:14 +0000
parents c7c14960f413
children b6b30ba53986
comparison
equal deleted inserted replaced
85:fe0b33370244 86:b89712288636
1 # $Id: hyperdb.py,v 1.2 2001-07-22 12:09:32 richard Exp $ 1 # $Id: hyperdb.py,v 1.3 2001-07-27 05:17:14 richard Exp $
2 2
3 # standard python modules 3 # standard python modules
4 import cPickle, re, string 4 import cPickle, re, string
5 5
6 # roundup modules 6 # roundup modules
591 # now, sort the result 591 # now, sort the result
592 def sortfun(a, b, sort=sort, group=group, properties=self.getprops(), 592 def sortfun(a, b, sort=sort, group=group, properties=self.getprops(),
593 db = self.db, cl=self): 593 db = self.db, cl=self):
594 a_id, an = a 594 a_id, an = a
595 b_id, bn = b 595 b_id, bn = b
596 # sort by group and then sort
596 for list in group, sort: 597 for list in group, sort:
597 for dir, prop in list: 598 for dir, prop in list:
598 # handle the properties that might be "faked" 599 # handle the properties that might be "faked"
599 if not an.has_key(prop): 600 if not an.has_key(prop):
600 an[prop] = cl.get(a_id, prop) 601 an[prop] = cl.get(a_id, prop)
659 r = cmp(len(av), len(bv)) 660 r = cmp(len(av), len(bv))
660 if r != 0: return r 661 if r != 0: return r
661 elif dir == '-': 662 elif dir == '-':
662 r = cmp(len(bv), len(av)) 663 r = cmp(len(bv), len(av))
663 if r != 0: return r 664 if r != 0: return r
665 # end for dir, prop in list:
666 # end for list in sort, group:
667 # if all else fails, compare the ids
664 return cmp(a[0], b[0]) 668 return cmp(a[0], b[0])
669
665 l.sort(sortfun) 670 l.sort(sortfun)
666 return [i[0] for i in l] 671 return [i[0] for i in l]
667 672
668 def count(self): 673 def count(self):
669 """Get the number of nodes in this class. 674 """Get the number of nodes in this class.
733 cl.create(name=option[i], order=i) 738 cl.create(name=option[i], order=i)
734 return hyperdb.Link(name) 739 return hyperdb.Link(name)
735 740
736 # 741 #
737 # $Log: not supported by cvs2svn $ 742 # $Log: not supported by cvs2svn $
743 # Revision 1.2 2001/07/22 12:09:32 richard
744 # Final commit of Grande Splite
745 #
738 # Revision 1.1 2001/07/22 11:58:35 richard 746 # Revision 1.1 2001/07/22 11:58:35 richard
739 # More Grande Splite 747 # More Grande Splite
740 # 748 #

Roundup Issue Tracker: http://roundup-tracker.org/