File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -230,18 +230,20 @@ def clean(self):
230230 host_type : [error_same_acl_name ],
231231 "name" : [error_same_acl_name ],
232232 }
233- if self . instance . pk :
234- # Check if Access List has no existing rules before change the Access List's type.
235- if (
233+ if (
234+ self . instance . pk
235+ and (
236236 acl_type == ACLTypeChoices .TYPE_EXTENDED
237237 and self .instance .aclstandardrules .exists ()
238- ) or (
238+ )
239+ or (
239240 acl_type == ACLTypeChoices .TYPE_STANDARD
240241 and self .instance .aclextendedrules .exists ()
241- ):
242- error_message ["type" ] = [
243- "This ACL has ACL rules associated, CANNOT change ACL type." ,
244- ]
242+ )
243+ ):
244+ error_message ["type" ] = [
245+ "This ACL has ACL rules associated, CANNOT change ACL type." ,
246+ ]
245247
246248 if error_message :
247249 raise forms .ValidationError (error_message )
You can’t perform that action at this time.
0 commit comments