]> git.ipfire.org Git - people/ms/libloc.git/blobdiff - src/python/location-exporter.in
location-export: Validate country codes
[people/ms/libloc.git] / src / python / location-exporter.in
index 1e3be265c4977465d9132ff8c954d9c659e02224..12bc29a1070e57d08b7bec7f0d8b79e507b0f91d 100644 (file)
@@ -280,12 +280,12 @@ class CLI(object):
 
                                asns.append(object)
 
-                       elif not len(object) == 2:
-                               log.error("Invalid argument: %s" % object)
-                               return 2
+                       elif location.country_code_is_valid(object):
+                               countries.append(object)
 
                        else:
-                               countries.append(object)
+                               log.error("Invalid argument: %s" % object)
+                               return 2
 
                # Open the database
                try: