]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
python: Only return country codes we want
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 16 Nov 2020 15:20:50 +0000 (15:20 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 16 Nov 2020 15:20:50 +0000 (15:20 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/export.py

index be4a68efb2fc36b762288bdb9d8346f2e8223fd7..5e7fe539cebb871a37752c4f9f9a689d63e1135e 100644 (file)
@@ -184,8 +184,14 @@ class Exporter(object):
 
                                writers[asn] = self.writer.open(self.db, filename, prefix="AS%s" % asn)
 
+                       # Filter countries from special country codes
+                       country_codes = [
+                               country_code for country_code in countries if not country_code in flags.values()
+                       ]
+
                        # Get all networks that match the family
-                       networks = self.db.search_networks(family=family, flatten=True)
+                       networks = self.db.search_networks(family=family,
+                               country_codes=country_codes, flatten=True)
 
                        # Walk through all networks
                        for network in networks: