Skip to content

Commit

Permalink
Improved default settings fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
palm86 committed Aug 8, 2014
1 parent b204de9 commit 4689b09
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hunger/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@

def setting(name):
"""Return setting value for given name or default value."""
setting = getattr(settings, name, None)
if setting is None and name in DEFAULT_SETTINGS:
try:
setting = getattr(settings, name)
except AttributeError:
setting = DEFAULT_SETTINGS[name]
return setting

Expand Down

0 comments on commit 4689b09

Please sign in to comment.