Browse Source

Simplify subnet inclusion testing

Baptiste Jonglez 11 years ago
parent
commit
ba3aeac766
1 changed files with 1 additions and 3 deletions
  1. 1 3
      coin/resources/models.py

+ 1 - 3
coin/resources/models.py

@@ -61,10 +61,8 @@ class IPSubnet(models.Model):
                 raise ValidationError('Unable to allocate an IP subnet in the specified pool: not enough space left.')
             self.inet = first_free.subnet(SUBNET_SIZE, 1).next()
         else:
-            pool = IPSet([self.ip_pool.inet])
-            subnet = IPSet([self.inet])
             # Check that we are included in the IP pool.
-            if not subnet.issubset(pool):
+            if not subnet in pool:
                 raise ValidationError('Subnet must be included in the IP pool.')
             # Check that we don't conflict with existing subnets.
             # TODO: use precise database query instead of querying all