Skip to content

Commit

Permalink
setting function groks injectable as well as explicit default
Browse files Browse the repository at this point in the history
  • Loading branch information
toliwaga committed Jan 10, 2018
1 parent 97eb36b commit dcaf0b3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion activitysim/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,18 @@ def setting(key, default=None):

settings = inject.get_injectable('settings')

return settings.get(key, default)
# explicit setting in settings file takes precedence
s = settings.get(key, None)

# if no setting, try injectable
if s is None:
s = inject.get_injectable(key, None)

# otherwise fall back to supplied default
if s is None:
s = default

return s


def read_model_settings(configs_dir, file_name):
Expand Down

0 comments on commit dcaf0b3

Please sign in to comment.