improve performance

This commit is contained in:
Emmanuel Garette 2014-11-10 23:15:08 +01:00
parent f03cbeadb7
commit 7c5b6e2db2
3 changed files with 16 additions and 9 deletions

View File

@ -717,6 +717,12 @@ class GroupConfig(_CommonConfig):
pass
return self._find_return_results(ret, display_error)
def __repr__(self):
return object.__repr__(self)
def __str__(self):
return object.__str__(self)
class MetaConfig(GroupConfig):
__slots__ = tuple()

View File

@ -132,16 +132,17 @@ class OptionDescription(BaseOption, StorageOptionDescription):
for option in self._impl_getchildren(dyn=False):
#FIXME specifique id for sqlalchemy?
#FIXME avec sqlalchemy ca marche le multi parent ? (dans des configs différentes)
#if option.id is None:
# raise SystemError(_("an option's id should not be None "
# "for {0}").format(option.impl_getname()))
if option._get_id() in cache_option: # pragma: optional cover
raise ConflictError(_('duplicate option: {0}').format(option))
cache_option.append(option._get_id())
oid = option._get_id()
cache_option.append(oid)
option._set_readonly()
if isinstance(option, OptionDescription):
option.impl_validate_options(cache_option)
if init:
if len(cache_option) != len(set(cache_option)):
for idx in xrange(1, len(cache_option)+1):
opt = cache_option.pop(0)
if opt in cache_option:
raise ConflictError(_('duplicate option: {0}').format(opt))
self._set_readonly()
# ____________________________________________________________

View File

@ -102,7 +102,7 @@ class Values(object):
#doit passer de meta à pas meta
#en plus il faut gérer la longueur avec les meta !
#FIXME SymLinkOption
value = meta.cfgimpl_get_values()[opt]
value = meta.cfgimpl_get_values()._get_cached_item(opt, path)
if isinstance(value, Multi):
if index is not undefined:
value = value[index]
@ -356,8 +356,8 @@ class Values(object):
raise ConfigError(_('owner only avalaible for an option'))
context = self._getcontext()
setting = context.cfgimpl_get_settings()
if 'frozen' in setting[opt] and \
'force_default_on_freeze' in setting[opt]:
if 'frozen' in setting._getitem(opt, path) and \
'force_default_on_freeze' in setting._getitem(opt, path):
return owners.default
if validate_properties:
self._getitem(opt, path, True, force_permissive, None, True)