add SlaveError for slave's length
This commit is contained in:
parent
e08bd93cd8
commit
410add6a2a
2 changed files with 20 additions and 12 deletions
|
@ -29,11 +29,20 @@
|
||||||
#AttributeError if no option or optiondescription in optiondescription (also when specified a path)
|
#AttributeError if no option or optiondescription in optiondescription (also when specified a path)
|
||||||
|
|
||||||
|
|
||||||
|
#____________option___________
|
||||||
|
class PropertiesOptionError(AttributeError):
|
||||||
|
"try to access to opt with not allowed property"
|
||||||
|
def __init__(self, msg, proptype):
|
||||||
|
self.proptype = proptype
|
||||||
|
super(PropertiesOptionError, self).__init__(msg)
|
||||||
|
|
||||||
|
|
||||||
class ConflictOptionError(StandardError):
|
class ConflictOptionError(StandardError):
|
||||||
"more than one option"
|
"more than one option"
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
#____________config___________
|
||||||
class ConfigError(StandardError):
|
class ConfigError(StandardError):
|
||||||
"""try to change owner for an option without value
|
"""try to change owner for an option without value
|
||||||
or if error in calculation"""
|
or if error in calculation"""
|
||||||
|
@ -45,13 +54,12 @@ class ConflictConfigError(ConfigError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class PropertiesOptionError(AttributeError):
|
#____________other___________
|
||||||
"try to access to opt with not allowed property"
|
|
||||||
def __init__(self, msg, proptype):
|
|
||||||
self.proptype = proptype
|
|
||||||
super(PropertiesOptionError, self).__init__(msg)
|
|
||||||
|
|
||||||
|
|
||||||
class RequirementRecursionError(StandardError):
|
class RequirementRecursionError(StandardError):
|
||||||
"recursive error"
|
"recursive error"
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class SlaveError(StandardError):
|
||||||
|
"problem with slave's length"
|
||||||
|
pass
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#
|
#
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
from time import time
|
from time import time
|
||||||
from tiramisu.error import ConfigError
|
from tiramisu.error import ConfigError, SlaveError
|
||||||
from tiramisu.setting import owners, multitypes, expires_time
|
from tiramisu.setting import owners, multitypes, expires_time
|
||||||
from tiramisu.autolib import carry_out_calculation
|
from tiramisu.autolib import carry_out_calculation
|
||||||
from tiramisu.i18n import _
|
from tiramisu.i18n import _
|
||||||
|
@ -214,7 +214,7 @@ class Multi(list):
|
||||||
masterlen = len(mastervalue)
|
masterlen = len(mastervalue)
|
||||||
if len(value) > masterlen or (len(value) < masterlen and
|
if len(value) > masterlen or (len(value) < masterlen and
|
||||||
not self.context.cfgimpl_get_values().is_default_owner(self.opt)):
|
not self.context.cfgimpl_get_values().is_default_owner(self.opt)):
|
||||||
raise ValueError(_("invalid len for the slave: {0}"
|
raise SlaveError(_("invalid len for the slave: {0}"
|
||||||
" which has {1} as master").format(
|
" which has {1} as master").format(
|
||||||
self.opt._name, masterp))
|
self.opt._name, masterp))
|
||||||
elif len(value) < masterlen:
|
elif len(value) < masterlen:
|
||||||
|
@ -230,7 +230,7 @@ class Multi(list):
|
||||||
if not values.is_default_owner(slave):
|
if not values.is_default_owner(slave):
|
||||||
value_slave = values._get_value(slave)
|
value_slave = values._get_value(slave)
|
||||||
if len(value_slave) > masterlen:
|
if len(value_slave) > masterlen:
|
||||||
raise ValueError(_("invalid len for the master: {0}"
|
raise SlaveError(_("invalid len for the master: {0}"
|
||||||
" which has {1} as slave with"
|
" which has {1} as slave with"
|
||||||
" greater len").format(
|
" greater len").format(
|
||||||
self.opt._name, slave._name))
|
self.opt._name, slave._name))
|
||||||
|
@ -250,7 +250,7 @@ class Multi(list):
|
||||||
"""
|
"""
|
||||||
if not force:
|
if not force:
|
||||||
if self.opt.get_multitype() == multitypes.slave:
|
if self.opt.get_multitype() == multitypes.slave:
|
||||||
raise ValueError(_("cannot append a value on a multi option {0}"
|
raise SlaveError(_("cannot append a value on a multi option {0}"
|
||||||
" which is a slave").format(self.opt._name))
|
" which is a slave").format(self.opt._name))
|
||||||
elif self.opt.get_multitype() == multitypes.master:
|
elif self.opt.get_multitype() == multitypes.master:
|
||||||
for slave in self.opt.get_master_slaves():
|
for slave in self.opt.get_master_slaves():
|
||||||
|
@ -278,7 +278,7 @@ class Multi(list):
|
||||||
"""
|
"""
|
||||||
if not force:
|
if not force:
|
||||||
if self.opt.get_multitype() == multitypes.slave:
|
if self.opt.get_multitype() == multitypes.slave:
|
||||||
raise ValueError(_("cannot pop a value on a multi option {0}"
|
raise SlaveError(_("cannot pop a value on a multi option {0}"
|
||||||
" which is a slave").format(self.opt._name))
|
" which is a slave").format(self.opt._name))
|
||||||
elif self.opt.get_multitype() == multitypes.master:
|
elif self.opt.get_multitype() == multitypes.master:
|
||||||
for slave in self.opt.get_master_slaves():
|
for slave in self.opt.get_master_slaves():
|
||||||
|
|
Loading…
Reference in a new issue