Mercurial > p > roundup > code
comparison roundup/hyperdb.py @ 305:cb6d168b5aaa
Hyperdatabase sorts strings-that-look-like-numbers as numbers now.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Sat, 20 Oct 2001 23:44:27 +0000 |
| parents | 49be38bb6e9a |
| children | 5a2c43891c20 |
comparison
equal
deleted
inserted
replaced
| 304:e130c5193544 | 305:cb6d168b5aaa |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: hyperdb.py,v 1.26 2001-10-16 03:48:01 richard Exp $ | 18 # $Id: hyperdb.py,v 1.27 2001-10-20 23:44:27 richard Exp $ |
| 19 | 19 |
| 20 # standard python modules | 20 # standard python modules |
| 21 import cPickle, re, string | 21 import cPickle, re, string |
| 22 | 22 |
| 23 # roundup modules | 23 # roundup modules |
| 695 av = an[prop] = av.lower() | 695 av = an[prop] = av.lower() |
| 696 if bv and bv[0] in string.uppercase: | 696 if bv and bv[0] in string.uppercase: |
| 697 bv = bn[prop] = bv.lower() | 697 bv = bn[prop] = bv.lower() |
| 698 if (isinstance(propclass, String) or | 698 if (isinstance(propclass, String) or |
| 699 isinstance(propclass, Date)): | 699 isinstance(propclass, Date)): |
| 700 # it might be a string that's really an integer | |
| 701 try: | |
| 702 av = int(av) | |
| 703 bv = int(bv) | |
| 704 except: | |
| 705 pass | |
| 700 if dir == '+': | 706 if dir == '+': |
| 701 r = cmp(av, bv) | 707 r = cmp(av, bv) |
| 702 if r != 0: return r | 708 if r != 0: return r |
| 703 elif dir == '-': | 709 elif dir == '-': |
| 704 r = cmp(bv, av) | 710 r = cmp(bv, av) |
| 838 cl.create(name=option[i], order=i) | 844 cl.create(name=option[i], order=i) |
| 839 return hyperdb.Link(name) | 845 return hyperdb.Link(name) |
| 840 | 846 |
| 841 # | 847 # |
| 842 # $Log: not supported by cvs2svn $ | 848 # $Log: not supported by cvs2svn $ |
| 849 # Revision 1.26 2001/10/16 03:48:01 richard | |
| 850 # admin tool now complains if a "find" is attempted with a non-link property. | |
| 851 # | |
| 843 # Revision 1.25 2001/10/11 00:17:51 richard | 852 # Revision 1.25 2001/10/11 00:17:51 richard |
| 844 # Reverted a change in hyperdb so the default value for missing property | 853 # Reverted a change in hyperdb so the default value for missing property |
| 845 # values in a create() is None and not '' (the empty string.) This obviously | 854 # values in a create() is None and not '' (the empty string.) This obviously |
| 846 # breaks CSV import/export - the string 'None' will be created in an | 855 # breaks CSV import/export - the string 'None' will be created in an |
| 847 # export/import operation. | 856 # export/import operation. |
