Merge lp:~laney/software-center/1510237 into lp:software-center

Proposed by Iain Lane on 2016-01-19
Status: Merged
Merged at revision: 3342
Proposed branch: lp:~laney/software-center/1510237
Merge into: lp:software-center
Diff against target: 21 lines (+8/-3)
1 file modified
softwarecenter/region.py (+8/-3)
To merge this branch: bzr merge lp:~laney/software-center/1510237
Reviewer Review Type Date Requested Status
software-store-developers 2016-01-19 Pending
Review via email: mp+283181@code.launchpad.net

Commit message

Patch from Robin van der Vilet to not crash on locales with no country.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/region.py'
2--- softwarecenter/region.py 2012-11-28 16:58:59 +0000
3+++ softwarecenter/region.py 2016-01-19 17:06:50 +0000
4@@ -111,9 +111,14 @@
5 return res
6 if not loc:
7 return res
8- countrycode = loc.split("_")[1]
9- res["countrycode"] = countrycode
10- res["country"] = get_region_name(countrycode)
11+
12+ try:
13+ countrycode = loc.split("_")[1]
14+ res["countrycode"] = countrycode
15+ res["country"] = get_region_name(countrycode)
16+ except IndexError as e:
17+ LOG.warn("Failed to get locale: '%s'" % e)
18+
19 return res
20
21 def _get_region_geoclue(self):