Created
October 2, 2017 22:24
-
-
Save joffilyfe/5486066b63f860b8129491a722899bb3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_setting_by_name(name, settings): | |
res = list(filter(myfilter(name), settings)) | |
if not res: | |
return None | |
if isinstance(res[0].setting_value, str): | |
try: | |
value = res[0].setting_value.encode("latin1").decode("utf8") | |
except: | |
value = res[0].setting_value | |
else: | |
value = res[0].setting_value | |
return value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment