From cb570790e6d23dd4ec74d365cdd72ec62c072d7e Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 24 Jul 2020 09:26:20 -0400 Subject: [PATCH] Fixes #4895: Force UTF-8 encoding when embedding model documentation --- docs/models/dcim/powerfeed.md | 2 +- docs/release-notes/version-2.8.md | 1 + netbox/utilities/templatetags/helpers.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/models/dcim/powerfeed.md b/docs/models/dcim/powerfeed.md index ab8621e14..690e755d7 100644 --- a/docs/models/dcim/powerfeed.md +++ b/docs/models/dcim/powerfeed.md @@ -2,7 +2,7 @@ A power feed identifies the power outlet/drop that goes to a rack and is terminated to a power panel. Power feeds have a supply type (AC/DC), voltage, amperage, and phase type (single/three). -Power feeds are optionally assigned to a rack. In addition, a power port – and only one – can connect to a power feed; in the context of a PDU, the power feed is analogous to the power outlet that a PDU's power port/inlet connects to. +Power feeds are optionally assigned to a rack. In addition, a power port may be connected to a power feed. In the context of a PDU, the power feed is analogous to the power outlet that a PDU's power port/inlet connects to. !!! info The power usage of a rack is calculated when a power feed (or multiple) is assigned to that rack and connected to a power port. diff --git a/docs/release-notes/version-2.8.md b/docs/release-notes/version-2.8.md index 5a55fb6e1..0222a46ee 100644 --- a/docs/release-notes/version-2.8.md +++ b/docs/release-notes/version-2.8.md @@ -9,6 +9,7 @@ * [#4880](https://github.com/netbox-community/netbox/issues/4880) - Fix removal of tagged VLANs if not assigned in bulk interface editing * [#4887](https://github.com/netbox-community/netbox/issues/4887) - Don't disable NAPALM tabs when device has no primary IP * [#4894](https://github.com/netbox-community/netbox/issues/4894) - Fix display of device/VM counts on platforms list +* [#4895](https://github.com/netbox-community/netbox/issues/4895) - Force UTF-8 encoding when embedding model documentation --- diff --git a/netbox/utilities/templatetags/helpers.py b/netbox/utilities/templatetags/helpers.py index a70e917d8..b5d19124b 100644 --- a/netbox/utilities/templatetags/helpers.py +++ b/netbox/utilities/templatetags/helpers.py @@ -170,7 +170,7 @@ def get_docs(model): model._meta.model_name ) try: - with open(path) as docfile: + with open(path, encoding='utf-8') as docfile: content = docfile.read() except FileNotFoundError: return "Unable to load documentation, file not found: {}".format(path)