Skip to content

Commit

Permalink
Optimize location lookup, avoid repeated config reads
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcandy committed Apr 20, 2020
1 parent 8e95b96 commit aa02369
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions elodie/geolocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,16 @@ def get_prefer_english_names():

config_file = '%s/config.ini' % constants.application_directory
if not path.exists(config_file):
__PREFER_ENGLISH_NAMES__ = False
return False

config = load_config()
if('MapQuest' not in config):
__PREFER_ENGLISH_NAMES__ = False
return False

if('prefer_english_names' not in config['MapQuest']):
__PREFER_ENGLISH_NAMES__ = False
return False

__PREFER_ENGLISH_NAMES__ = bool(config['MapQuest']['prefer_english_names'])
Expand Down

0 comments on commit aa02369

Please sign in to comment.