Explorar el Código

Fixes #4895: Force UTF-8 encoding when embedding model documentation

Jeremy Stretch hace 5 años
padre
commit
cb570790e6

+ 1 - 1
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.

+ 1 - 0
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
 
 ---
 

+ 1 - 1
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)