Skip to content

Commit 310cc4d

Browse files
author
Richard Jones
committed
*sigh* more missing value handling
1 parent 1ecae9b commit 310cc4d

File tree

2 files changed

+29
-12
lines changed

2 files changed

+29
-12
lines changed

roundup/htmltemplate.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: htmltemplate.py,v 1.42 2001-11-21 03:40:54 richard Exp $
18+
# $Id: htmltemplate.py,v 1.43 2001-11-21 04:04:43 richard Exp $
1919

2020
import os, re, StringIO, urllib, cgi, errno
2121

@@ -573,7 +573,7 @@ def render(self, filterspec={}, filter=[], columns=[], sort=[], group=[],
573573
for nodeid in nodeids:
574574
# check for a group heading
575575
if group_names:
576-
this_group = [self.cl.get(nodeid, name) for name in group_names]
576+
this_group = [self.cl.get(nodeid, name, '[no value]') for name in group_names]
577577
if this_group != old_group:
578578
l = []
579579
for name in group_names:
@@ -593,7 +593,7 @@ def render(self, filterspec={}, filter=[], columns=[], sort=[], group=[],
593593
for value in self.cl.get(nodeid, name):
594594
l.append(group_cl.get(value, key))
595595
else:
596-
value = self.cl.get(nodeid, name)
596+
value = self.cl.get(nodeid, name, '[no value]')
597597
if value is None:
598598
value = '[empty %s]'%name
599599
else:
@@ -861,6 +861,9 @@ def render(self, form):
861861

862862
#
863863
# $Log: not supported by cvs2svn $
864+
# Revision 1.42 2001/11/21 03:40:54 richard
865+
# more new property handling
866+
#
864867
# Revision 1.41 2001/11/15 10:26:01 richard
865868
# . missing "return" in filter_section (thanks Roch'e Compaan)
866869
#

roundup/hyperdb.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
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 $
1919

2020
# standard python modules
2121
import cPickle, re, string
@@ -680,17 +680,28 @@ def sortfun(a, b, sort=sort, group=group, properties=self.getprops(),
680680
# sort by group and then sort
681681
for list in group, sort:
682682
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-
691683
# sorting is class-specific
692684
propclass = properties[prop]
693685

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 = ''
704+
694705
# String and Date values are sorted in the natural way
695706
if isinstance(propclass, String):
696707
# clean up the strings
@@ -849,6 +860,9 @@ def Choice(name, *options):
849860

850861
#
851862
# $Log: not supported by cvs2svn $
863+
# Revision 1.33 2001/11/21 03:40:54 richard
864+
# more new property handling
865+
#
852866
# Revision 1.32 2001/11/21 03:11:28 richard
853867
# Better handling of new properties.
854868
#

0 commit comments

Comments
 (0)