This commit is contained in:
Emmanuel Garette 2013-08-28 09:16:12 +02:00
parent cb7e4b8893
commit 397a600be7
1 changed files with 7 additions and 10 deletions

View File

@ -69,7 +69,7 @@ class BaseInformation(object):
except AttributeError: except AttributeError:
raise AttributeError(_('{0} has no attribute ' raise AttributeError(_('{0} has no attribute '
'impl_set_information').format( 'impl_set_information').format(
self.__class__.__name__)) self.__class__.__name__))
def impl_get_information(self, key, default=None): def impl_get_information(self, key, default=None):
"""retrieves one information's item """retrieves one information's item
@ -87,7 +87,7 @@ class BaseInformation(object):
except AttributeError: except AttributeError:
raise AttributeError(_('{0} has no attribute ' raise AttributeError(_('{0} has no attribute '
'impl_get_information').format( 'impl_get_information').format(
self.__class__.__name__)) self.__class__.__name__))
class Option(BaseInformation): class Option(BaseInformation):
@ -150,7 +150,7 @@ class Option(BaseInformation):
except ValueError, err: except ValueError, err:
raise ValueError(_("invalid default_multi value {0} " raise ValueError(_("invalid default_multi value {0} "
"for option {1}: {2}").format( "for option {1}: {2}").format(
str(default_multi), name, err)) str(default_multi), name, err))
if callback is not None and (default is not None or if callback is not None and (default is not None or
default_multi is not None): default_multi is not None):
raise ValueError(_("default value not allowed if option: {0} " raise ValueError(_("default value not allowed if option: {0} "
@ -180,8 +180,8 @@ class Option(BaseInformation):
if not isinstance(properties, tuple): if not isinstance(properties, tuple):
raise TypeError(_('invalid properties type {0} for {1},' raise TypeError(_('invalid properties type {0} for {1},'
' must be a tuple').format( ' must be a tuple').format(
type(properties), type(properties),
self._name)) self._name))
self._properties = properties # 'hidden', 'disabled'... self._properties = properties # 'hidden', 'disabled'...
def __eq__(self, other): def __eq__(self, other):
@ -329,7 +329,7 @@ class Option(BaseInformation):
"no default value has been set yet" "no default value has been set yet"
if ((not self.impl_is_multi() and self._default is None) or if ((not self.impl_is_multi() and self._default is None) or
(self.impl_is_multi() and (self._default == [] (self.impl_is_multi() and (self._default == []
or None in self._default))): or None in self._default))):
return True return True
return False return False
@ -1003,10 +1003,7 @@ def validate_requires_arg(requires, name):
ret_action = [] ret_action = []
for require in opt_requires.values(): for require in opt_requires.values():
req = (require[0], tuple(require[1]), req = (require[0], tuple(require[1]),
require[2], require[2], require[3], require[4], require[5])
require[3],
require[4],
require[5])
ret_action.append(req) ret_action.append(req)
ret.append(tuple(ret_action)) ret.append(tuple(ret_action))
return frozenset(config_action.keys()), tuple(ret) return frozenset(config_action.keys()), tuple(ret)