##// END OF EJS Templates
Document in widget packing that vaues must be JSON-able.
Jonathan Frederic -
Show More
@@ -281,7 +281,7 b' class Widget(LoggingConfigurable):'
281 """Recursively converts all widget instances to model id strings.
281 """Recursively converts all widget instances to model id strings.
282
282
283 Children widgets will be stored and transmitted to the front-end by
283 Children widgets will be stored and transmitted to the front-end by
284 their model ids."""
284 their model ids. Return value must be JSON-able."""
285 if isinstance(x, dict):
285 if isinstance(x, dict):
286 return {k: self._pack_widgets(v) for k, v in x.items()}
286 return {k: self._pack_widgets(v) for k, v in x.items()}
287 elif isinstance(x, list):
287 elif isinstance(x, list):
@@ -289,7 +289,7 b' class Widget(LoggingConfigurable):'
289 elif isinstance(x, Widget):
289 elif isinstance(x, Widget):
290 return x.model_id
290 return x.model_id
291 else:
291 else:
292 return x
292 return x # Value must be JSON-able
293
293
294 def _unpack_widgets(self, x):
294 def _unpack_widgets(self, x):
295 """Recursively converts all model id strings to widget instances.
295 """Recursively converts all model id strings to widget instances.
General Comments 0
You need to be logged in to leave comments. Login now