Skip to content

Commit b6ea478

Browse files
author
Richard Jones
committed
backport from HEAD
1 parent fe85d4d commit b6ea478

File tree

2 files changed

+33
-22
lines changed

2 files changed

+33
-22
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Fixed:
1313
- fixed fallback excel writer in rcsv so it has a delimiter
1414
- fixed setup.py's use of listTemplates (!)
1515
- make rdbms serialise() less trusting
16+
- handle Boolean values in history HTML display
1617

1718

1819
2004-03-01 0.6.7

roundup/cgi/templating.py

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -599,25 +599,27 @@ def history(self, direction='descending', dre=re.compile('\d+')):
599599
timezone = self._db.getUserTimezone()
600600
if direction == 'descending':
601601
history.reverse()
602+
# pre-load the history with the current state
602603
for prop_n in self._props.keys():
603604
prop = self[prop_n]
604-
if isinstance(prop, HTMLProperty):
605-
current[prop_n] = prop.plain()
606-
# make link if hrefable
607-
if (self._props.has_key(prop_n) and
608-
isinstance(self._props[prop_n], hyperdb.Link)):
609-
classname = self._props[prop_n].classname
610-
try:
611-
template = find_template(self._db.config.TEMPLATES,
612-
classname, 'item')
613-
if template[1].startswith('_generic'):
614-
raise NoTemplate, 'not really...'
615-
except NoTemplate:
616-
pass
617-
else:
618-
id = self._klass.get(self._nodeid, prop_n, None)
619-
current[prop_n] = '<a href="%s%s">%s</a>'%(
620-
classname, id, current[prop_n])
605+
if not isinstance(prop, HTMLProperty):
606+
continue
607+
current[prop_n] = prop.plain()
608+
# make link if hrefable
609+
if (self._props.has_key(prop_n) and
610+
isinstance(self._props[prop_n], hyperdb.Link)):
611+
classname = self._props[prop_n].classname
612+
try:
613+
template = find_template(self._db.config.TEMPLATES,
614+
classname, 'item')
615+
if template[1].startswith('_generic'):
616+
raise NoTemplate, 'not really...'
617+
except NoTemplate:
618+
pass
619+
else:
620+
id = self._klass.get(self._nodeid, prop_n, None)
621+
current[prop_n] = '<a href="%s%s">%s</a>'%(
622+
classname, id, current[prop_n])
621623

622624
for id, evt_date, user, action, args in history:
623625
date_s = str(evt_date.local(timezone)).replace("."," ")
@@ -739,17 +741,25 @@ def history(self, direction='descending', dre=re.compile('\d+')):
739741
current[k] = str(d)
740742

741743
elif isinstance(prop, hyperdb.Interval) and args[k]:
742-
d = date.Interval(args[k])
743-
cell.append('%s: %s'%(k, str(d)))
744+
val = str(date.Interval(args[k]))
745+
cell.append('%s: %s'%(k, val))
744746
if current.has_key(k):
745747
cell[-1] += ' -> %s'%current[k]
746-
current[k] = str(d)
748+
current[k] = val
747749

748750
elif isinstance(prop, hyperdb.String) and args[k]:
749-
cell.append('%s: %s'%(k, cgi.escape(args[k])))
751+
val = cgi.escape(args[k])
752+
cell.append('%s: %s'%(k, val))
753+
if current.has_key(k):
754+
cell[-1] += ' -> %s'%current[k]
755+
current[k] = val
756+
757+
elif isinstance(prop, hyperdb.Boolean) and args[k] is not None:
758+
val = args[k] and 'Yes' or 'No'
759+
cell.append('%s: %s'%(k, val))
750760
if current.has_key(k):
751761
cell[-1] += ' -> %s'%current[k]
752-
current[k] = cgi.escape(args[k])
762+
current[k] = val
753763

754764
elif not args[k]:
755765
if current.has_key(k):

0 commit comments

Comments
 (0)