mirror of
https://github.com/FliegendeWurst/googleplay-api.git
synced 2024-11-22 04:44:59 +00:00
Tightened locale checks
Consider the case when locale is manually initalized with a non-string value, and the case when python's getdefaultlocale() returns None
This commit is contained in:
parent
1cece7d3ff
commit
12109621a6
@ -54,8 +54,13 @@ class DeviceBuilder(object):
|
||||
self.device[key] = value
|
||||
|
||||
def setLocale(self, locale):
|
||||
if locale is None:
|
||||
# test if provided locale is valid
|
||||
if locale is None or type(locale) is not str:
|
||||
# try to fetch it from system
|
||||
locale = getdefaultlocale()[0]
|
||||
# getdefaultlocale may return None, we need another check
|
||||
if locale is None:
|
||||
locale = ''
|
||||
|
||||
# check if locale matches the structure of a common
|
||||
# value like "en_US"
|
||||
|
Loading…
Reference in New Issue
Block a user