From: richard Date: Wed, 31 Mar 2004 23:45:28 +0000 (+0000) Subject: handle Boolean values in history HTML display X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4dcc983fbe0cb8200829603c29fe72256de6deb6;p=roundup.git handle Boolean values in history HTML display git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@2240 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/CHANGES.txt b/CHANGES.txt index b48d2d2..7ed151b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -8,6 +8,7 @@ Fixed: places (thanks Toby Sargeant) - MySQL and Postgresql use BOOL/BOOLEAN for Boolean types - OTK generation was busted (thanks Stuart D. Gathman) +- handle Boolean values in history HTML display 2004-03-27 0.7.0b2 diff --git a/roundup/cgi/templating.py b/roundup/cgi/templating.py index 372b8fe..50f612a 100644 --- a/roundup/cgi/templating.py +++ b/roundup/cgi/templating.py @@ -689,25 +689,27 @@ class HTMLItem(HTMLInputMixin, HTMLPermissions): timezone = self._db.getUserTimezone() if direction == 'descending': history.reverse() + # pre-load the history with the current state for prop_n in self._props.keys(): prop = self[prop_n] - if isinstance(prop, HTMLProperty): - current[prop_n] = prop.plain() - # make link if hrefable - if (self._props.has_key(prop_n) and - isinstance(self._props[prop_n], hyperdb.Link)): - classname = self._props[prop_n].classname - try: - template = find_template(self._db.config.TEMPLATES, - classname, 'item') - if template[1].startswith('_generic'): - raise NoTemplate, 'not really...' - except NoTemplate: - pass - else: - id = self._klass.get(self._nodeid, prop_n, None) - current[prop_n] = '%s'%( - classname, id, current[prop_n]) + if not isinstance(prop, HTMLProperty): + continue + current[prop_n] = prop.plain() + # make link if hrefable + if (self._props.has_key(prop_n) and + isinstance(self._props[prop_n], hyperdb.Link)): + classname = self._props[prop_n].classname + try: + template = find_template(self._db.config.TEMPLATES, + classname, 'item') + if template[1].startswith('_generic'): + raise NoTemplate, 'not really...' + except NoTemplate: + pass + else: + id = self._klass.get(self._nodeid, prop_n, None) + current[prop_n] = '%s'%( + classname, id, current[prop_n]) for id, evt_date, user, action, args in history: date_s = str(evt_date.local(timezone)).replace("."," ") @@ -829,17 +831,25 @@ class HTMLItem(HTMLInputMixin, HTMLPermissions): current[k] = str(d) elif isinstance(prop, hyperdb.Interval) and args[k]: - d = date.Interval(args[k]) - cell.append('%s: %s'%(k, str(d))) + val = str(date.Interval(args[k])) + cell.append('%s: %s'%(k, val)) if current.has_key(k): cell[-1] += ' -> %s'%current[k] - current[k] = str(d) + current[k] = val elif isinstance(prop, hyperdb.String) and args[k]: - cell.append('%s: %s'%(k, cgi.escape(args[k]))) + val = cgi.escape(args[k]) + cell.append('%s: %s'%(k, val)) + if current.has_key(k): + cell[-1] += ' -> %s'%current[k] + current[k] = val + + elif isinstance(prop, hyperdb.Boolean) and args[k] is not None: + val = args[k] and 'Yes' or 'No' + cell.append('%s: %s'%(k, val)) if current.has_key(k): cell[-1] += ' -> %s'%current[k] - current[k] = cgi.escape(args[k]) + current[k] = val elif not args[k]: if current.has_key(k):