forked from LBRYCommunity/lbry-sdk
Add separate list of excluded fields to AdjustableSettings
Adds "environ" field. Also renames __excluded to _excluded so it can be overridden by child classes.
This commit is contained in:
parent
8bb7517f32
commit
879c01ba00
1 changed files with 4 additions and 2 deletions
|
@ -45,11 +45,11 @@ else:
|
||||||
class Settings(object):
|
class Settings(object):
|
||||||
"""A collection of configuration settings"""
|
"""A collection of configuration settings"""
|
||||||
__fixed = []
|
__fixed = []
|
||||||
__excluded = ['get_dict', 'update']
|
_excluded = ['get_dict', 'update']
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
for k in self.__dict__.iterkeys():
|
for k in self.__dict__.iterkeys():
|
||||||
if k.startswith('_') or k in self.__excluded:
|
if k.startswith('_') or k in self._excluded:
|
||||||
continue
|
continue
|
||||||
yield k
|
yield k
|
||||||
|
|
||||||
|
@ -180,6 +180,8 @@ ENVIRONMENT = Env(
|
||||||
|
|
||||||
|
|
||||||
class AdjustableSettings(Settings):
|
class AdjustableSettings(Settings):
|
||||||
|
_excluded = ['get_dict', 'update', 'environ']
|
||||||
|
|
||||||
"""Settings that are allowed to be overriden by the user"""
|
"""Settings that are allowed to be overriden by the user"""
|
||||||
def __init__(self, environ=None):
|
def __init__(self, environ=None):
|
||||||
self.environ = environ or ENVIRONMENT
|
self.environ = environ or ENVIRONMENT
|
||||||
|
|
Loading…
Add table
Reference in a new issue