浏览代码

Merge pull request #128 from britannic/no-firewall-configured

Fix for no firewall rules exist use case
Roberto Bertó 5 年之前
父节点
当前提交
a8411debdc
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      vycontrol/firewall/views.py

+ 5 - 4
vycontrol/firewall/views.py

@@ -53,10 +53,11 @@ def index(request):
     if firewall_all == False:
         return redirect('firewall:firewall-create')
 
-    for xitem in firewall_all['name']:
-        if 'default-action' in firewall_all['name'][xitem]:
-            firewall_all['name'][xitem]['default_action'] = firewall_all['name'][xitem]['default-action']
-            del firewall_all['name'][xitem]['default-action']
+    if 'name' in firewall_all: 
+        for xitem in firewall_all['name']:
+            if 'default-action' in firewall_all['name'][xitem]:
+                firewall_all['name'][xitem]['default_action'] = firewall_all['name'][xitem]['default-action']
+                del firewall_all['name'][xitem]['default-action']
 
     template = loader.get_template('firewall/list.html')
     context = {