Show More
@@ -277,11 +277,26 b' var IPython = (function (IPython) {' | |||||
277 | "javascript" : "application/javascript", |
|
277 | "javascript" : "application/javascript", | |
278 | }; |
|
278 | }; | |
279 |
|
279 | |||
|
280 | OutputArea.prototype._safe_set_mime = function (src, dest, srckey, destkey) { | |||
|
281 | destkey = destkey || srckey; | |||
|
282 | ||||
|
283 | var value = src[srckey]; | |||
|
284 | if (value !== undefined) { | |||
|
285 | // For now, everything is a string, | |||
|
286 | // but JSON should really not be double-serialized. | |||
|
287 | if (typeof value !== 'string') { | |||
|
288 | console.log("Invalid type for " + destkey, value); | |||
|
289 | } else { | |||
|
290 | dest[destkey] = value; | |||
|
291 | } | |||
|
292 | } | |||
|
293 | }; | |||
|
294 | ||||
280 | OutputArea.prototype.rename_keys = function (data, key_map) { |
|
295 | OutputArea.prototype.rename_keys = function (data, key_map) { | |
281 | var remapped = {}; |
|
296 | var remapped = {}; | |
282 | for (var key in data) { |
|
297 | for (var key in data) { | |
283 | var new_key = key_map[key] || key; |
|
298 | var new_key = key_map[key] || key; | |
284 | remapped[new_key] = data[key]; |
|
299 | this._safe_set_mime(data, remapped, key, new_key); | |
285 | } |
|
300 | } | |
286 | return remapped; |
|
301 | return remapped; | |
287 | }; |
|
302 | }; |
General Comments 0
You need to be logged in to leave comments.
Login now