reliure.option¶
Option objects used in reliure.Optionable.
inheritance diagrams¶
Class¶
-
class
reliure.options.ListOption(name, otype)¶ Bases:
reliure.options.Optionoption with multiple value
-
parse(values)¶
-
validate(values)¶
-
-
class
reliure.options.Option(name, otype)¶ Bases:
objectAbstract option value
-
static
FromType(name, otype)¶ ValueOption subclasses factory, creates a convenient option to store data from a given Type.
attribute precedence :
|attrs| > 0(multianduniqare implicit) => NotImplementedErroruniq(multiis implicit) => NotImplementedErrormultiandnot uniq=> NotImplementedErrornot multi=> ValueOption
Parameters: - name (str) – Name of the option
- otype (subclass of
GenericType) – the desired type of field
-
__init__(name, otype)¶ Parameters: - name (str) – option name
- otype (subclass of
GenericType) – option type
-
as_dict()¶ returns a dictionary view of the option
Returns: the option converted in a dict Return type: dict
-
clear()¶ Reset the option value (default will be used)
-
default¶ Default value of the option
Warning
changing the default value also change the current value
-
name¶ Name of the option.
-
parse(value)¶ Convert the value from data just decoded from json.
Parameters: value – a potential value for the option Returns: the value converted to the good type
-
set(value, parse=False)¶ Set the value of the option.
One can also set the ‘value’ property:
>>> opt = ValueOption("oname", Numeric(default=1,help="an option exemple")) >>> opt.value = 12
Parameters: value – the new value
-
summary()¶
-
validate(value)¶ Raises
ValidationErrorif the value is not correct, else just returns the given value.It is called when a new value is setted.
Parameters: value – the value to validate Returns: the value
-
value¶ Value of the option
-
static
-
class
reliure.options.SetOption(name, otype)¶ Bases:
reliure.options.Optionoption with multiple value
-
parse(values)¶
-
validate(values)¶
-
-
class
reliure.options.ValueOption(name, otype)¶ Bases:
reliure.options.OptionSingle value option
-
parse(value)¶
-
validate(value)¶
-