File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -243,11 +243,17 @@ define([
243243 'text/plain'
244244 ] ;
245245
246- OutputArea . prototype . validate_mimebundle = function ( json ) {
247- /**
248- * scrub invalid outputs
249- */
250- var data = json . data ;
246+ OutputArea . prototype . validate_mimebundle = function ( bundle ) {
247+ /** scrub invalid outputs */
248+ if ( typeof bundle . data !== 'object' ) {
249+ console . warn ( "mimebundle missing data" , bundle ) ;
250+ bundle . data = { } ;
251+ }
252+ if ( typeof bundle . metadata !== 'object' ) {
253+ console . warn ( "mimebundle missing metadata" , bundle ) ;
254+ bundle . metadata = { } ;
255+ }
256+ var data = bundle . data ;
251257 $ . map ( OutputArea . output_types , function ( key ) {
252258 if ( key !== 'application/json' &&
253259 data [ key ] !== undefined &&
@@ -257,7 +263,7 @@ define([
257263 delete data [ key ] ;
258264 }
259265 } ) ;
260- return json ;
266+ return bundle ;
261267 } ;
262268
263269 OutputArea . prototype . append_output = function ( json ) {
Original file line number Diff line number Diff line change @@ -51,7 +51,10 @@ def set_parent(self, parent):
5151 self .parent_header = extract_header (parent )
5252
5353 def start_displayhook (self ):
54- self .msg = self .session .msg (u'execute_result' , {}, parent = self .parent_header )
54+ self .msg = self .session .msg (u'execute_result' , {
55+ 'data' : {},
56+ 'metadata' : {},
57+ }, parent = self .parent_header )
5558
5659 def write_output_prompt (self ):
5760 """Write the output prompt."""
You can’t perform that action at this time.
0 commit comments