Permalink
Browse files

debug JSON encoding (WTF)

  • Loading branch information...
1 parent b54b410 commit 225acb0c5484c701eb4fc9a180ef1a3f24539afb @minrk committed Mar 7, 2013
@@ -658,6 +658,9 @@ def put(self, notebook_id):
nbm = self.application.notebook_manager
format = self.get_argument('format', default='json')
name = self.get_argument('name', default=None)
+ print 'v-'*30
+ print repr(self.request.body)
+ print '^-'*30
nbm.save_notebook(notebook_id, self.request.body, name=name, format=format)
self.set_status(204)
self.finish()
@@ -1276,7 +1276,7 @@ var IPython = (function (IPython) {
cache : false,
type : "PUT",
data : JSON.stringify(data),
- headers : {'Content-Type': 'application/json'},
+ headers : {'Content-Type': 'application/json; charset=UTF-8'},
success : $.proxy(this.save_notebook_success,this),
error : $.proxy(this.save_notebook_error,this)
};
@@ -58,7 +58,14 @@ def writes(self, nb, **kwargs):
kwargs['separators'] = (',',': ')
if kwargs.pop('split_lines', True):
nb = split_lines(copy.deepcopy(nb))
- return py3compat.str_to_unicode(json.dumps(nb, **kwargs), 'utf-8')
+ s = py3compat.str_to_unicode(json.dumps(nb, **kwargs), 'utf-8')
+ try:
+ print nb.worksheets[0].cells[:1]
+ print s[s.find('cells'):]
+ except Exception:
+ pass
+
+ return s
_reader = JSONReader()

0 comments on commit 225acb0

Please sign in to comment.