comparison piecrust/data/debug.py @ 7:343d08ef5668

More PieCrust 3 fixes, and a couple of miscellaneous bug fixes.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 16 Aug 2014 15:07:22 -0700
parents 474c9882decf
children 395eb38f2dfb
comparison
equal deleted inserted replaced
6:f5ca5c5bed85 7:343d08ef5668
173 173
174 if data_type is float: 174 if data_type is float:
175 self._write('<span style="%s">%4.2f</span>' % (CSS_VALUE, data)) 175 self._write('<span style="%s">%4.2f</span>' % (CSS_VALUE, data))
176 return 176 return
177 177
178 if data_type in (str, str): 178 if data_type is str:
179 if data_type == str:
180 data = data.decode('utf8')
181 if len(data) > DebugDataRenderer.MAX_VALUE_LENGTH: 179 if len(data) > DebugDataRenderer.MAX_VALUE_LENGTH:
182 data = data[:DebugDataRenderer.MAX_VALUE_LENGTH - 5] 180 data = data[:DebugDataRenderer.MAX_VALUE_LENGTH - 5]
183 data += '[...]' 181 data += '[...]'
184 data = cgi.escape(data).encode('ascii', 'xmlcharrefreplace') 182 data = cgi.escape(data).encode('ascii', 'xmlcharrefreplace')
185 self._write('<span style="%s">%s</span>' % (CSS_VALUE, data)) 183 self._write('<span style="%s">%s</span>' % (CSS_VALUE, data))