Commit 3e19fa85 authored by Aleksey Shirokih's avatar Aleksey Shirokih
Browse files

sanitize chars before processing template 2

--HG--
branch : feature/microservices
parent 409df540
......@@ -28,15 +28,19 @@ class LinkDashboard(BaseDashboard):
def render(self):
mos = self.object
if mos.interfaces[0].description:
mos.interfaces[0].description = mos.interfaces[0].description.replace('\"', '')
if mos.interfaces[1].description:
mos.interfaces[1].description = mos.interfaces[1].description.replace('\"', '')
context = {
"device_a": mos.interfaces[0].managed_object.name.replace('\"', ''),
"device_b": mos.interfaces[1].managed_object.name.replace('\"', ''),
"interface_a": {
"name": mos.interfaces[0].name,
"descr": mos.interfaces[0].description.replace('\"', '') or mos.interfaces[0].name},
"descr": mos.interfaces[0].description or mos.interfaces[0].name},
"interface_b": {
"name": mos.interfaces[1].name,
"descr": mos.interfaces[1].description.replace('\"', '') or mos.interfaces[1].name},
"descr": mos.interfaces[1].description or mos.interfaces[1].name},
"segment": mos.managed_objects[0].segment.id,
"device_a_id": mos.managed_objects[0].id,
"device_b_id": mos.managed_objects[1].id,
......
......@@ -52,15 +52,16 @@ class MODashboard(BaseDashboard):
ifaces = [i for i in all_ifaces if i.profile == profile]
ports = []
for iface in sorted(ifaces, key=split_alnum):
if iface.description:
iface.description = iface.description.replace('\"', '')
if iface.type == u"aggregated":
lags += [{
"name": iface.name,
"ports": [i.name for i in iface.lag_members],
"descr": iface.description.replace('\"', '') or "No description"
"descr": iface.description or "No description"
}]
continue
ports += [{"name": iface.name, "descr": iface.description.replace('\"', '')}]
ports += [{"name": iface.name, "descr": iface.description}]
port_types += [{"type": profile.id, "name": profile.name,
"ports": ports}]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment