Commits

jayven committed eeea826

Make value shorter

Comments (0)

Files changed (2)

     _columns = {
         'console': fields.many2one('hotdebug.console', 'Console'),
         'filename': fields.char('Filename', size=256, readonly=True),
-        'where': fields.char('Where', size=256, readonly=True),
+        'where': fields.char('Source', size=256, readonly=True),
         'lineno': fields.integer('Lineno', readonly=True),
         'line': fields.text('Line', readonly=True),
         'lines': fields.text('Lines', readonly=True),
 
 
 class TracebackLocals(osv.osv_memory):
+
+    value_short_limit = 128
+
+    def _value_short_get(self, cr, uid, ids, field_name, arg, context=None):
+        ret = {}
+        for loc in self.browse(cr, uid, ids, context=context):
+            if len(loc.value) < self.value_short_limit:
+                ret[loc.id] = loc.value
+            else:
+                ret[loc.id] = loc.value[:self.value_short_limit - 3] + '...'
+        return ret
+
     _name = 'hotdebug.tb.locals'
     _columns = {
         'tb': fields.many2one('hotdebug.tb', 'Traceback'),
         'name': fields.char('Name', size=256, readonly=True),
         'value': fields.text('Value', readonly=True),
+        'value_short': fields.function(_value_short_get, type='char',
+            size=value_short_limit,
+            method=True,
+            string='Value'),
     }
 
 TracebackLocals()
                     <separator colspan="4" string="Name" />
                     <field name="name" nolabel="1" colspan="4"/>
                     <separator colspan="4" string="Value" />
-                    <field name="value" nolabel="1" colspan="4"/>
+                    <field name="value_short" nolabel="1" colspan="4"/>
                 </form>
             </field>
         </record>