Mercurial > p > roundup > code
comparison roundup/hyperdb.py @ 398:bbbcdee47762
*sigh* more missing value handling
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 21 Nov 2001 04:04:43 +0000 |
| parents | d47818b09265 |
| children | bdc2ea127ae9 |
comparison
equal
deleted
inserted
replaced
| 397:d47818b09265 | 398:bbbcdee47762 |
|---|---|
| 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.33 2001-11-21 03:40:54 richard Exp $ | 18 # $Id: hyperdb.py,v 1.34 2001-11-21 04:04:43 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 |
| 678 a_id, an = a | 678 a_id, an = a |
| 679 b_id, bn = b | 679 b_id, bn = b |
| 680 # sort by group and then sort | 680 # sort by group and then sort |
| 681 for list in group, sort: | 681 for list in group, sort: |
| 682 for dir, prop in list: | 682 for dir, prop in list: |
| 683 # handle the properties that might be "faked" | |
| 684 if not an.has_key(prop): | |
| 685 an[prop] = cl.get(a_id, prop) | |
| 686 av = an[prop] | |
| 687 if not bn.has_key(prop): | |
| 688 bn[prop] = cl.get(b_id, prop) | |
| 689 bv = bn[prop] | |
| 690 | |
| 691 # sorting is class-specific | 683 # sorting is class-specific |
| 692 propclass = properties[prop] | 684 propclass = properties[prop] |
| 685 | |
| 686 # handle the properties that might be "faked" | |
| 687 # also, handle possible missing properties | |
| 688 try: | |
| 689 if not an.has_key(prop): | |
| 690 an[prop] = cl.get(a_id, prop) | |
| 691 av = an[prop] | |
| 692 except KeyError: | |
| 693 # the node doesn't have a value for this property | |
| 694 if isinstance(propclass, Multilink): av = [] | |
| 695 else: av = '' | |
| 696 try: | |
| 697 if not bn.has_key(prop): | |
| 698 bn[prop] = cl.get(b_id, prop) | |
| 699 bv = bn[prop] | |
| 700 except KeyError: | |
| 701 # the node doesn't have a value for this property | |
| 702 if isinstance(propclass, Multilink): bv = [] | |
| 703 else: bv = '' | |
| 693 | 704 |
| 694 # String and Date values are sorted in the natural way | 705 # String and Date values are sorted in the natural way |
| 695 if isinstance(propclass, String): | 706 if isinstance(propclass, String): |
| 696 # clean up the strings | 707 # clean up the strings |
| 697 if av and av[0] in string.uppercase: | 708 if av and av[0] in string.uppercase: |
| 847 cl.create(name=option[i], order=i) | 858 cl.create(name=option[i], order=i) |
| 848 return hyperdb.Link(name) | 859 return hyperdb.Link(name) |
| 849 | 860 |
| 850 # | 861 # |
| 851 # $Log: not supported by cvs2svn $ | 862 # $Log: not supported by cvs2svn $ |
| 863 # Revision 1.33 2001/11/21 03:40:54 richard | |
| 864 # more new property handling | |
| 865 # | |
| 852 # Revision 1.32 2001/11/21 03:11:28 richard | 866 # Revision 1.32 2001/11/21 03:11:28 richard |
| 853 # Better handling of new properties. | 867 # Better handling of new properties. |
| 854 # | 868 # |
| 855 # Revision 1.31 2001/11/12 22:01:06 richard | 869 # Revision 1.31 2001/11/12 22:01:06 richard |
| 856 # Fixed issues with nosy reaction and author copies. | 870 # Fixed issues with nosy reaction and author copies. |
