summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglatzor@ubuntu.com <>2006-07-27 22:40:09 +0200
committerglatzor@ubuntu.com <>2006-07-27 22:40:09 +0200
commit2179699f8b08b68be792cb0e5f263931475fc26d (patch)
treefdbf7393acb0e0fc5af678c976cd944ba790270f
parent7403f3888293e0c9ff544a218decaf6b428b2396 (diff)
downloadpython-apt-2179699f8b08b68be792cb0e5f263931475fc26d.tar.gz
* add an error handler if the locale is not in the iso country list
-rw-r--r--SoftwareProperties/SoftwareProperties.py12
-rw-r--r--SoftwareProperties/aptsources.py5
2 files changed, 12 insertions, 5 deletions
diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py
index 93028206..9e9071be 100644
--- a/SoftwareProperties/SoftwareProperties.py
+++ b/SoftwareProperties/SoftwareProperties.py
@@ -292,10 +292,14 @@ class SoftwareProperties(SimpleGladeApp):
self.combobox_server.set_model(server_store)
server_store.append([_("Main server"),
self.distro.main_server])
- # TRANSLATORS: %s is a country
- server_store.append([_("Server for %s") % gettext.dgettext("iso-3166",
- self.distro.country).rstrip(),
- self.distro.nearest_server])
+ if self.distro.country != None:
+ # TRANSLATORS: %s is a country
+ server_store.append([_("Server for %s") % gettext.dgettext("iso-3166",
+ self.distro.country).rstrip(),
+ self.distro.nearest_server])
+ else:
+ server_store.append([_("Nearest server"),
+ self.distro.nearest_server])
if len(self.distro.used_servers) > 0:
for server in self.distro.used_servers:
if not re.match(server, self.distro.main_server) and \
diff --git a/SoftwareProperties/aptsources.py b/SoftwareProperties/aptsources.py
index 40b55dfa..a4d16fa0 100644
--- a/SoftwareProperties/aptsources.py
+++ b/SoftwareProperties/aptsources.py
@@ -563,7 +563,10 @@ class Distribution:
country_code = locale[a+1:z].lower()
self.nearest_server = "http://%s.archive.ubuntu.com/ubuntu/" % \
country_code
- self.country = self.countries[country_code]
+ if self.countries.has_key(country_code):
+ self.country = self.countries[country_code]
+ else:
+ self.country = None
# other used servers
for medium in self.used_media: