Show More
@@ -622,7 +622,7 b' class JSON(DisplayObject):' | |||||
622 | """ |
|
622 | """ | |
623 | # wrap data in a property, which warns about passing already-serialized JSON |
|
623 | # wrap data in a property, which warns about passing already-serialized JSON | |
624 | _data = None |
|
624 | _data = None | |
625 | def __init__(self, data=None, url=None, filename=None, metadata=None, **kwargs): |
|
625 | def __init__(self, data=None, url=None, filename=None, expanded=False, metadata=None, **kwargs): | |
626 | """Create a JSON display object given raw data. |
|
626 | """Create a JSON display object given raw data. | |
627 |
|
627 | |||
628 | Parameters |
|
628 | Parameters | |
@@ -640,9 +640,11 b' class JSON(DisplayObject):' | |||||
640 | metadata: dict |
|
640 | metadata: dict | |
641 | Specify extra metadata to attach to the json display object. |
|
641 | Specify extra metadata to attach to the json display object. | |
642 | """ |
|
642 | """ | |
643 |
self.metadata = |
|
643 | self.metadata = {'expanded': expanded} | |
644 | if metadata: |
|
644 | if metadata: | |
645 | self.metadata.update(metadata) |
|
645 | self.metadata.update(metadata) | |
|
646 | if kwargs: | |||
|
647 | self.metadata.update(kwargs) | |||
646 | super(JSON, self).__init__(data=data, url=url, filename=filename) |
|
648 | super(JSON, self).__init__(data=data, url=url, filename=filename) | |
647 |
|
649 | |||
648 | def _check_data(self): |
|
650 | def _check_data(self): |
@@ -159,7 +159,7 b' def test_displayobject_repr():' | |||||
159 | def test_json(): |
|
159 | def test_json(): | |
160 | d = {'a': 5} |
|
160 | d = {'a': 5} | |
161 | lis = [d] |
|
161 | lis = [d] | |
162 | md = {} |
|
162 | md = {'expanded': False} | |
163 | md2 = {'expanded': True} |
|
163 | md2 = {'expanded': True} | |
164 | j = display.JSON(d) |
|
164 | j = display.JSON(d) | |
165 | j2 = display.JSON(d, expanded=True) |
|
165 | j2 = display.JSON(d, expanded=True) |
General Comments 0
You need to be logged in to leave comments.
Login now