Skip to content

Commit

Permalink
refactor: ♻️ Tweak use of mark_safe
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrew82 committed Jan 5, 2024
1 parent a49582c commit e0d0dac
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nautobot_ssot/templatetags/render_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def render_diff_recursive(diff):
"""
result = ""
for record_type, children in diff.items():
child_result = ""
child_result = mark_safe("") # noqa: S308
for child, child_diffs in children.items():
if "+" in child_diffs and "-" not in child_diffs:
child_class = "diff-added"
Expand All @@ -54,12 +54,12 @@ def render_diff_recursive(diff):
child_result += render_diff_recursive(child_diffs)

child_result += "</ul></li>"
result += format_html("<li>{}<ul>{}</ul></li>", record_type, mark_safe(child_result)) # noqa: S308
result += format_html("<li>{}<ul>{}</ul></li>", record_type, child_result)
return result


@register.simple_tag
def render_diff(diff):
"""Render a DiffSync diff dict to HTML."""
html_text = render_diff_recursive(diff)
return format_html("<ul>{}</ul>", mark_safe(html_text)) # noqa: S308
return format_html("<ul>{}</ul>", html_text)

0 comments on commit e0d0dac

Please sign in to comment.