Commits

jayven committed 77ea0c7

Fix bugs in import/export tracebacks

  • Participants
  • Parent commits 717f8d6
  • Branches refactor
  • Tags r0.0.1

Comments (0)

Files changed (2)

 import sys, json
 import pooler
 import linecache
+import base64
 from datetime import datetime
 from itertools import izip, islice
 from pprint import pformat
                 }
                 t['locals'].append((0, 0, l))
             res['last_traceback'].append((0, 0, t))
-        res = json.dumps(res, separators=(',', ':'))    
+        res = base64.b64encode(json.dumps(res, separators=(',', ':')))
         res_id = self.pool.get('hotdebug.tb.export').create(cr, uid, {
             'file': res,
             'filename': datetime.now().strftime(
             'target': 'new',
             'context': context,
         }
+
+    def clear_tb(self, cr, uid, ids, context=None):
+        self._clear_exc(cr, uid, ids[0], context)
+        return True
         
     _name = 'hotdebug.console'
     _columns = {
         if not rec.file:
             raise osv.except_osv('Error', 'Please select import file')
         try:
-            value = json.loads(rec.file)
+            value = json.loads(base64.b64decode(rec.file))
         except ValueError:
             raise osv.except_osv('Error', 'Bad content')
         # TODO: more check for value
                             <field name="last_value" nolabel="1" colspan="4" />
                             <field name="last_traceback"  string="tracebacks" widget="one2many_list" nolabel="1" readonly="1" colspan="4" />
                             <newline />
+                            <button colspan="2" name="clear_tb" string="Clear Tracebacks"
+                                type="object" icon="gtk-go-forward" />
+                            <newline />
                             <button colspan="2" name="export_tb" string="Export Tracebacks"
                                 type="object" icon="gtk-go-forward" />
                             <button colspan="2" name="import_tb" string="Import Tracebacks"