Skip to content

Commit

Permalink
api: use correct app.config idiom for defaults
Browse files Browse the repository at this point in the history
I don't know what I was thinking earlier. ``app.config.get()`` does what
I want here.
  • Loading branch information
rjw57 committed Oct 24, 2014
1 parent eae896f commit 827d49c
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions tawhiri/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@
# Util functions ##############################################################
def ruaumoko_ds():
if not hasattr("ruaumoko_ds", "once"):
try:
ds_loc = app.config['ELEVATION_DATASET']
except KeyError:
ds_loc = ElevationDataset.default_location
ds_loc = app.config.get('ELEVATION_DATASET', ElevationDataset.default_location)
ruaumoko_ds.once = ElevationDataset(ds_loc)

return ruaumoko_ds.once
Expand Down Expand Up @@ -202,10 +199,7 @@ def run_prediction(req):
}

# Find wind data location
try:
ds_dir = app.config['WIND_DATASET_DIR']
except KeyError:
ds_dir = WindDataset.DEFAULT_DIRECTORY
app.config.get('WIND_DATASET_DIR', WindDataset.DEFAULT_DIRECTORY)

# Dataset
try:
Expand Down

0 comments on commit 827d49c

Please sign in to comment.