Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix circular reference for html repr #1058

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/hdmf/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,9 @@

if isinstance(fields, dict):
for key, value in fields.items():
if value is self:
return f'<div style="margin-left: {level * 20}px;" class="container-fields"> Circular reference ' \

Check warning on line 629 in src/hdmf/container.py

View check run for this annotation

Codecov / codecov/patch

src/hdmf/container.py#L629

Added line #L629 was not covered by tests
f'detected for {value.name} </div>'
current_access_code = f"{access_code}.{key}" if is_field else f"{access_code}['{key}']"
if hasattr(value, '_generate_field_html'):
html_repr += value._generate_field_html(key, value, level, current_access_code)
Expand Down
Loading