Skip to content

Commit

Permalink
Fix issue with types on mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
gmjosack committed Jan 12, 2015
1 parent bc2aa2b commit 42ead5b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nsot/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def networks(self, include_networks=True, include_ips=False, root=False,
if subnets_of is not None:
subnets_of = ipaddress.ip_network(unicode(subnets_of))
query = query.filter(
Network.ip_version == subnets_of.version,
Network.ip_version == str(subnets_of.version),
Network.prefix_length > subnets_of.prefixlen,
Network.network_address >= subnets_of.network_address.packed,
Network.broadcast_address <= subnets_of.broadcast_address.packed
Expand All @@ -340,7 +340,7 @@ def networks(self, include_networks=True, include_ips=False, root=False,
if supernets_of is not None:
supernets_of = ipaddress.ip_network(unicode(supernets_of))
query = query.filter(
Network.ip_version == supernets_of.version,
Network.ip_version == str(supernets_of.version),
Network.prefix_length < supernets_of.prefixlen,
Network.network_address <= supernets_of.network_address.packed,
Network.broadcast_address >= supernets_of.broadcast_address.packed
Expand Down Expand Up @@ -535,6 +535,7 @@ def subnets(self, session, include_networks=True, include_ips=False,
return query.filter(Network.parent_id == self.id).all()

return query.filter(
Network.site_id == self.site_id,
Network.ip_version == self.ip_version,
Network.prefix_length > self.prefix_length,
Network.network_address >= self.network_address,
Expand Down

0 comments on commit 42ead5b

Please sign in to comment.