From 41e9dbad3b6b8754299c406f254774f53c9623cf Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:42:46 -0800 Subject: [PATCH 1/5] add option to use a value's html field generation method --- src/hdmf/container.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hdmf/container.py b/src/hdmf/container.py index 614fbbccd..889fcf490 100644 --- a/src/hdmf/container.py +++ b/src/hdmf/container.py @@ -626,7 +626,10 @@ def _generate_html_repr(self, fields, level=0, access_code="", is_field=False): if isinstance(fields, dict): for key, value in fields.items(): current_access_code = f"{access_code}.{key}" if is_field else f"{access_code}['{key}']" - html_repr += self._generate_field_html(key, value, level, current_access_code) + if hasattr(value, '_generate_field_html'): + html_repr += value._generate_field_html(key, value, level, current_access_code) + else: + html_repr += self._generate_field_html(key, value, level, current_access_code) elif isinstance(fields, list): for index, item in enumerate(fields): access_code += f'[{index}]' From 70a7a44dda18787c4acbd06125ead5a5a3dbd35d Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 24 Jan 2024 13:18:30 -0800 Subject: [PATCH 2/5] update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccb6bc516..f361eeaa4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Bug fixes - Fixed internal links in docstrings and tutorials. @stephprince [#1031](https://github.com/hdmf-dev/hdmf/pull/1031) - Fixed issue with creating documentation links to classes in docval arguments. @rly [#1036](https://github.com/hdmf-dev/hdmf/pull/1036) +- Fixed recursion error in html representation generation in jupyter notebooks. @stephprince [#1038](https://github.com/hdmf-dev/hdmf/pull/1038) ## HDMF 3.12.0 (January 16, 2024) From 3ac670fc10c738607d48c1c5b9b1e28441385562 Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Mon, 29 Jan 2024 11:32:04 -0800 Subject: [PATCH 3/5] update html representation docstring --- src/hdmf/container.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hdmf/container.py b/src/hdmf/container.py index 889fcf490..521568d95 100644 --- a/src/hdmf/container.py +++ b/src/hdmf/container.py @@ -642,7 +642,10 @@ def _generate_html_repr(self, fields, level=0, access_code="", is_field=False): return html_repr def _generate_field_html(self, key, value, level, access_code): - """Generates HTML for a single field.""" + """Generates HTML for a single field. + + This function can be overwritten by a child class to implement customized html representations. + """ if isinstance(value, (int, float, str, bool)): return f'