aboutsummaryrefslogtreecommitdiff
path: root/src/ppm
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-12-28 17:42:44 +0100
committerGuido Günther <agx@sigxcpu.org>2011-12-28 17:51:53 +0100
commit847e064252a9ccb4dd7022830514cbd1983ef413 (patch)
tree52e449de1d6f97adcea3fb824a662b5070349577 /src/ppm
parent9891aea1abe41e90659c7fc82239e2ee9a1fb909 (diff)
Display country name instead of country code
Diffstat (limited to 'src/ppm')
-rw-r--r--src/ppm/providerdb.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ppm/providerdb.py b/src/ppm/providerdb.py
index e2b097d..c1aebec 100644
--- a/src/ppm/providerdb.py
+++ b/src/ppm/providerdb.py
@@ -133,6 +133,13 @@ class ProviderDB(object):
for r in searcher(self.tree):
yield r.attrib['code']
+ def get_country_by_code(self, code):
+ """Given a country code return it's name"""
+ try:
+ return self.countries[code]
+ except KeyError:
+ return None
+
def get_countries(self):
for code in self.get_country_codes():
try: