Skip to content

Commit 66afe64

Browse files
author
Richard Jones
committed
applied patch for nicer history display (feature [SF#638280])
1 parent a9c1099 commit 66afe64

File tree

2 files changed

+38
-6
lines changed

2 files changed

+38
-6
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ are given with the most recent entry first.
88
- allow additional control over the roundupdb email sending (explicit
99
cc addresses, different from address and different nosy list property)
1010
(thanks John Rouillard)
11+
- applied patch for nicer history display (sf feature 638280)
1112

1213

1314
2003-01-10 0.5.4

roundup/cgi/templating.py

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ def __getitem__(self, item):
480480
if isinstance(prop, klass):
481481
return htmlklass(self._client, self._nodeid, prop, item, value)
482482

483-
raise KeyErorr, item
483+
raise KeyError, item
484484

485485
def __getattr__(self, attr):
486486
''' convenience access to properties '''
@@ -511,11 +511,23 @@ def history(self, direction='descending', dre=re.compile('\d+')):
511511
_('<th>Action</th>'),
512512
_('<th>Args</th>'),
513513
'</tr>']
514+
current = {}
514515
comments = {}
515516
history = self._klass.history(self._nodeid)
516517
history.sort()
517518
if direction == 'descending':
518519
history.reverse()
520+
for prop_n in self._props:
521+
prop = self[prop_n]
522+
if isinstance(prop, HTMLProperty):
523+
current[prop_n] = prop.plain()
524+
# make link if hrefable
525+
if prop_n in self._props and isinstance(self._props[prop_n], hyperdb.Link):
526+
classname = self._props[prop_n].classname
527+
if os.path.exists(os.path.join(self._db.config.TEMPLATES, classname + '.item')):
528+
current[prop_n] = '<a href="%s%s">%s</a>'%(classname,
529+
self._klass.get(self._nodeid, prop_n, None), current[prop_n])
530+
519531
for id, evt_date, user, action, args in history:
520532
date_s = str(evt_date).replace("."," ")
521533
arg_s = ''
@@ -610,27 +622,46 @@ def history(self, direction='descending', dre=re.compile('\d+')):
610622
label = None
611623
if label is not None:
612624
if hrefable:
613-
cell.append('%s: <a href="%s%s">%s</a>\n'%(k,
614-
classname, args[k], label))
625+
old = '<a href="%s%s">%s</a>'%(classname, args[k], label)
615626
else:
616-
cell.append('%s: %s' % (k,label))
627+
old = label;
628+
cell.append('%s: %s' % (k,old))
629+
if k in current:
630+
cell[-1] += ' -> %s'%current[k]
631+
current[k] = old
617632

618633
elif isinstance(prop, hyperdb.Date) and args[k]:
619634
d = date.Date(args[k])
620635
cell.append('%s: %s'%(k, str(d)))
636+
if k in current:
637+
cell[-1] += ' -> %s'%current[k]
638+
current[k] = str(d)
621639

622640
elif isinstance(prop, hyperdb.Interval) and args[k]:
623641
d = date.Interval(args[k])
624642
cell.append('%s: %s'%(k, str(d)))
643+
if k in current:
644+
cell[-1] += ' -> %s'%current[k]
645+
current[k] = str(d)
625646

626647
elif isinstance(prop, hyperdb.String) and args[k]:
627648
cell.append('%s: %s'%(k, cgi.escape(args[k])))
649+
if k in current:
650+
cell[-1] += ' -> %s'%current[k]
651+
current[k] = cgi.escape(args[k])
628652

629653
elif not args[k]:
630-
cell.append('%s: (no value)\n'%k)
654+
if k not in current:
655+
cell.append('%s: (no value)'%k)
656+
else:
657+
cell.append('%s: %s'%(k, current[k]))
658+
current[k] = '(no value)'
631659

632660
else:
633-
cell.append('%s: %s\n'%(k, str(args[k])))
661+
cell.append('%s: %s'%(k, str(args[k])))
662+
if k in current:
663+
cell[-1] += ' -> %s'%current[k]
664+
current[k] = str(args[k])
634665
else:
635666
# property no longer exists
636667
comments['no_exist'] = _('''<em>The indicated property

0 commit comments

Comments
 (0)