@@ -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