Skip to content

Commit

Permalink
Fix is_overridden ignoring class attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
orlnub123 committed Mar 12, 2019
1 parent 3959fd1 commit a964c1c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
### Fixed

- Fixed indented Settings subclasses erroring.
- Fixed `Settings.is_overridden` ignoring class attributes.

## [0.1.1] - 2018-11-20

Expand Down
7 changes: 6 additions & 1 deletion class_settings/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,9 @@ def __getattr__(self, name):
return getattr(default_settings, name)

def is_overridden(self, setting):
return setting in vars(self)
try:
self.__getattribute__(setting) # Avoids __getattr__
except AttributeError:
return False
else:
return True

0 comments on commit a964c1c

Please sign in to comment.