[r21450]Addons: Check for two-letter lang as well as 5-char locale
E.g, check fr as well as fr_FR svn: r21455
This commit is contained in:
parent
b99e2e29df
commit
7d7cc6f789
@ -377,12 +377,18 @@ class ViewManager(CLIManager):
|
|||||||
# now we have a list of languages to try:
|
# now we have a list of languages to try:
|
||||||
fp = None
|
fp = None
|
||||||
for lang in langs:
|
for lang in langs:
|
||||||
URL = "%s/listings/addons-%s.txt" % (config.get("behavior.addons-url"), lang)
|
URL = ("%s/listings/addons-%s.txt" %
|
||||||
|
(config.get("behavior.addons-url"), lang))
|
||||||
LOG.debug(" trying: %s" % URL)
|
LOG.debug(" trying: %s" % URL)
|
||||||
try:
|
try:
|
||||||
fp = urlopen(URL, timeout=10) # abort after 10 seconds
|
fp = urlopen(URL, timeout=10) # abort after 10 seconds
|
||||||
except: # some error
|
except:
|
||||||
LOG.debug(" IOError!")
|
try:
|
||||||
|
URL = ("%s/listings/addons-%s.txt" %
|
||||||
|
(config.get("behavior.addons-url"), lang[:2]))
|
||||||
|
fp = urlopen(URL, timeout=10)
|
||||||
|
except Exception as err: # some error
|
||||||
|
LOG.warn("Failed to open %s: %s" (lang, str(err)))
|
||||||
fp = None
|
fp = None
|
||||||
if fp and fp.getcode() == 200: # ok
|
if fp and fp.getcode() == 200: # ok
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user