owners are *real* objects now
This commit is contained in:
@ -42,6 +42,10 @@ class GroupModule(_const):
|
||||
*normal* means : groups that are not master
|
||||
"""
|
||||
pass
|
||||
class DefaultGroupName(GroupName):
|
||||
"""groups that are default (typically 'default')"""
|
||||
pass
|
||||
|
||||
class MasterGroupName(GroupName):
|
||||
"""allowed normal group (OptionDescription) names
|
||||
*master* means : groups that have the 'master' attribute set
|
||||
@ -54,16 +58,44 @@ def populate_groups():
|
||||
"populates the available groups in the appropriate namespaces"
|
||||
_available_group_names = ('default', 'family', 'group')
|
||||
_available_groups_with_a_master = ('group', )
|
||||
_available_default_groups = ('default', )
|
||||
# populates normal or master groups
|
||||
for grp in _available_group_names:
|
||||
if grp in _available_groups_with_a_master:
|
||||
setattr(groups, grp, groups.MasterGroupName(grp))
|
||||
elif grp in _available_default_groups:
|
||||
setattr(groups, grp, groups.DefaultGroupName(grp))
|
||||
else:
|
||||
setattr(groups, grp, groups.GroupName(grp))
|
||||
# names are in the module now
|
||||
populate_groups()
|
||||
# ____________________________________________________________
|
||||
class OwnerModule(_const):
|
||||
"""emulates a module to manage unique owner names.
|
||||
|
||||
owners are living in `Config._cfgimpl_value_owners`
|
||||
"""
|
||||
class Owner(str):
|
||||
"""allowed owner names
|
||||
"""
|
||||
pass
|
||||
class DefaultOwner(Owner):
|
||||
"""groups that are default (typically 'default')"""
|
||||
pass
|
||||
# setting.owners (emulates a module)
|
||||
owners = OwnerModule()
|
||||
|
||||
def populate_owners():
|
||||
"""populates the available owners in the appropriate namespaces
|
||||
|
||||
- 'user' is the generic is the generic owner.
|
||||
- 'default' is the config owner after init time
|
||||
"""
|
||||
setattr(owners, 'default', owners.DefaultOwner('default'))
|
||||
setattr(owners,'user', owners.Owner('user'))
|
||||
# names are in the module now
|
||||
populate_owners()
|
||||
#____________________________________________________________
|
||||
class Setting():
|
||||
"``Config()``'s configuration options"
|
||||
# properties attribute: the name of a property enables this property
|
||||
@ -75,8 +107,6 @@ class Setting():
|
||||
frozen = True
|
||||
# enables validation function for options if set
|
||||
validator = False
|
||||
# generic owner. 'default' is the general config owner after init time
|
||||
owner = 'user'
|
||||
# ____________________________________________________________
|
||||
# properties methods
|
||||
def has_properties(self):
|
||||
|
Reference in New Issue
Block a user