Explorar el Código

Fix issue if no static routes are defined

Neil Beadle hace 5 años
padre
commit
08c8e9ad1c
Se han modificado 1 ficheros con 6 adiciones y 5 borrados
  1. 6 5
      vycontrol/static/views.py

+ 6 - 5
vycontrol/static/views.py

@@ -23,11 +23,12 @@ def static_list(request):
     is_superuser = perms.get_is_superuser(request.user)
 
     static_list = []
-    for s in static_dict['route']:
-        static_list.append({
-            'route': s,
-            'nexthop': static_dict['route'][s]['next-hop'],
-        })
+    if static_dict :
+        for s in static_dict['route']:
+            static_list.append({
+                'route': s,
+                'nexthop': static_dict['route'][s]['next-hop'],
+            })
 
     template = loader.get_template('static/list.html')
     context = {