Commit Graph

294 Commits

Author SHA1 Message Date
Emmanuel Garette ab555966f7 use python-coverage to delete dead part of code 2015-11-24 10:58:19 +01:00
Emmanuel Garette 54ca54e505 separate value in slave 2015-11-19 22:25:00 +01:00
Emmanuel Garette a0de1109f7 optimise mandatory_warnings 2015-10-29 09:03:13 +01:00
Emmanuel Garette 8e7a32de08 add global 'empty' property, this property raise mandatory PropertiesOptionError if multi or master have empty value 2015-07-26 19:13:25 +02:00
Emmanuel Garette 6cc74506fb Some optimisations 2015-05-03 09:56:03 +02:00
Emmanuel Garette 487b99b32c for a multi mandatory, allow [] with allow_empty_list attribut 2015-04-20 14:49:43 +02:00
Emmanuel Garette 2c6275ffbd remove slave values when delete a master without value 2015-04-19 09:37:46 +02:00
Emmanuel Garette 057bba83e4 ValueError if not PropertieError 2015-04-18 23:46:37 +02:00
Emmanuel Garette 10768a6067 refactor validation 2015-04-18 22:53:45 +02:00
Emmanuel Garette c566ad1111 valid default/callback value in consistencies 2015-03-08 12:03:49 +01:00
Emmanuel Garette bc65caa4dc mandatory master/slave's consistency with default value as slave 2014-12-07 14:39:23 +01:00
Emmanuel Garette a801951a78 can reset slave value in all case when deleting master value 2014-12-01 23:08:56 +01:00
Emmanuel Garette 2ccf92f879 improve GroupConfig/MetaConfig
add set_value in GroupConfig
2014-12-01 21:49:50 +01:00
Emmanuel Garette 7c5b6e2db2 improve performance 2014-11-10 23:15:08 +01:00
Emmanuel Garette 4217508f3f works on sqlalchemy storage 2014-11-10 09:13:44 +01:00
Emmanuel Garette c75867720f add force_permissive in mandatory_warnings 2014-10-26 16:39:24 +01:00
Emmanuel Garette 4310d59991 add force_permissive to config __iter__ 2014-10-26 10:26:23 +01:00
Emmanuel Garette a130cff4bf frozen with force_default_on_freeze can change owner 2014-10-26 09:44:06 +01:00
Emmanuel Garette ed3373cff0 bad characters in DomainnameOption could be in warning level 2014-10-26 09:38:17 +01:00
Emmanuel Garette 8a59e27396 f option is frozen with force_default_on_freeze property, owner must be 'default' check property when tried to change owner 2014-10-26 08:51:45 +01:00
Emmanuel Garette 71f8926fca better support for sqlalchemy storage 2014-07-06 15:31:57 +02:00
Emmanuel Garette b64189f763 add DynOptionDescription 2014-06-19 23:22:39 +02:00
Emmanuel Garette 9112a8c5b0 add SubMulti 2014-04-26 22:37:01 +02:00
Emmanuel Garette b6a0f188b2 force_store_value now support Multi 2014-04-18 21:33:15 +02:00
Emmanuel Garette 22860099ba report/generate.py: corrections 2014-04-17 18:47:48 +02:00
Emmanuel Garette 5d8b5719a0 Merge branch 'master' into orm
Conflicts:
	test/test_config_api.py
	tiramisu/autolib.py
	tiramisu/config.py
	tiramisu/option.py
	tiramisu/value.py
2014-04-13 10:30:42 +02:00
Emmanuel Garette aa0734591d change None to undefined when it's needed 2014-04-12 21:57:17 +02:00
Emmanuel Garette 3ab0688c46 Arity change, remove force_properties:
* tiramisu/config.py (in cfgimpl_get_home_by_path and getattr)
 * tiramisu/value.py (in getitem):
2014-04-12 21:37:20 +02:00
Emmanuel Garette cd4d3527c7 split tiramisu/option.py and add MasterSlaves object 2014-04-12 17:55:13 +02:00
Emmanuel Garette a1f0c29713 Merge modification made for 1.0's branch 2014-04-02 12:06:11 +02:00
Emmanuel Garette 76a43a7ff9 if slave has a callback with a slave that has a callback with a default_multi's slave, now it's works 2014-04-02 12:04:50 +02:00
Emmanuel Garette 463fc8e88a if opt is freeze with force_default_on_freeze, didn't remove store value 2014-04-01 21:01:01 +02:00
Emmanuel Garette a3c5e6034f Merge branch 'force_permissive'
Conflicts:
	test/test_freeze.py
2014-03-31 22:38:56 +02:00
Emmanuel Garette cd52729952 add force_permissive in config's method (iter_all, iter_group, find, find_first and make_dict)
rename _getattr to getattr
2014-03-31 22:34:57 +02:00
Emmanuel Garette ff5376a382 properties are check now in getowner
get_modified_values works good with force_store_value
2014-03-29 20:31:56 +01:00
Emmanuel Garette 712db2875e force_store_value works now with permissive 2014-03-28 17:36:02 +01:00
Emmanuel Garette a04a61f1a4 Merge branch 'master' into lgpl 2014-03-15 10:11:17 +01:00
Emmanuel Garette db9ab7a1e9 test if cache property is not set in config when force_cache 2014-03-09 20:22:29 +01:00
Emmanuel Garette 6e8b570a37 mandatory_warnings is now in values and add force_cache to values 2014-03-09 20:06:44 +01:00
Emmanuel Garette 98bd35ad36 Merge branch 'master' into orm
Conflicts:
	tiramisu/config.py
	tiramisu/option.py
2014-02-04 21:54:30 +01:00
Emmanuel Garette a067d2cdd9 add some tests 2014-02-04 21:14:30 +01:00
Emmanuel Garette 5897231421 Merge branch 'master' into orm
Conflicts:
	test/test_dereference.py
	test/test_state.py
	tiramisu/config.py
	tiramisu/value.py
2014-02-02 18:52:13 +01:00
Emmanuel Garette 683e40fbb5 when change len of calculated master, change len of slave too 2014-02-02 18:20:01 +01:00
Emmanuel Garette 880b6366eb Merge branch 'master' into orm
Conflicts:
	tiramisu/setting.py
2014-01-25 16:39:32 +01:00
Emmanuel Garette 138018dfe9 if we delete all reference to a Config and we have reference to old SubConfig, Values, Multi or Settings, make a ConfigError instead of AttributError on NoneType object 2014-01-25 11:20:11 +01:00
Emmanuel Garette 64ca069a0b Merge branch 'master' into orm
Conflicts:
	test/test_config.py
	tiramisu/autolib.py
	tiramisu/option.py
	tiramisu/value.py
2013-12-12 17:50:42 +01:00
Emmanuel Garette 73745be440 Important behavior change : to add default_multi value, now use Multi.append(), not Multi.append(None) 2013-12-09 17:59:39 +01:00
Emmanuel Garette 20bef5ff04 Important behavior change in callback with multi.
Before, tiramisu iterable multi's callback_params in all cases.
Now, this append only if multi's callback_params are in master/slave group.
2013-12-09 15:08:14 +01:00
Emmanuel Garette 374c56a9c8 first version with sqlalchemy option's storage 2013-11-23 23:34:17 +01:00
Emmanuel Garette b7f85b8559 Merge branch 'master' into lgpl 2013-09-28 18:43:46 +02:00
Emmanuel Garette 70f684e70c tiramisu/option.py:
separate _consistencies (for Option) and _cache_consistencies (for OptionDescription)
  _launch_consistency need index for multi's option
  _cons_not_equal support multi options

tiramisu/value.py:
  Multi._validate support consistency
2013-09-28 17:05:01 +02:00
Emmanuel Garette f4677b9ef9 use warnings instead of a new dictionary 2013-09-26 21:56:06 +02:00
Emmanuel Garette f040d3da61 warning is now a dict 2013-09-26 18:35:20 +02:00
Emmanuel Garette 4e0f0a5b70 config_error is an exception, raise directly config_error 2013-09-25 10:22:31 +02:00
Emmanuel Garette 06baff2f3b add warning ability 2013-09-24 23:19:20 +02:00
Emmanuel Garette 8a7078d3b0 gpl to lgpl 2013-09-22 22:33:09 +02:00
Emmanuel Garette 051f1c8774 tiramisu/config.py:
- find byvalue support Multi

tiramisu/value.py:
 - Multi's pop comment
2013-09-22 21:23:12 +02:00
Emmanuel Garette c84d13a1c6 we can serialize Config now 2013-09-22 20:57:52 +02:00
Emmanuel Garette ae4df32d0e error if change slave len for default's slave option 2013-09-19 23:02:15 +02:00
Emmanuel Garette 90ae9aa70d refactore carry_out_calculation + test + documentation 2013-09-19 21:39:41 +02:00
Emmanuel Garette 866364059c dont change anything if config_error 2013-09-17 09:10:08 +02:00
Emmanuel Garette 57f4dd8d3f allow mandatory value (see 9ddf100118 for more details) 2013-09-16 20:51:13 +02:00
Emmanuel Garette 9ddf100118 when we get an option's value, we need it's values to calculate properties (ie for mandatory's option)
if a disabled option has a callback to an other disabled value, it's raise ConfigError

now only raise if option has no other propertiesError
2013-09-16 15:07:34 +02:00
Emmanuel Garette 77c1ccf40b add 'cache' property 2013-09-07 17:25:22 +02:00
Emmanuel Garette 22bfbb9fa4 storage no more in setting.py, code is now in storage/__init__.py 2013-09-06 23:15:36 +02:00
Emmanuel Garette aeeaf6ec14 impl_get_information and impl_set_information are, now, persistent in storage 2013-09-03 10:38:38 +02:00
Emmanuel Garette 8aa4260404 test force_default_on_freeze with multi and correction in Multi() 2013-08-28 22:50:35 +02:00
gwen fbf05ba5e4 python 3 compatibility
remove __eq__ and __ne__ in Option
2013-08-28 21:13:42 +02:00
Emmanuel Garette 3be005e82e add test test/test_dereference.py + memoryleaks in optiondescription's cache 2013-08-27 21:36:52 +02:00
Emmanuel Garette acd27fb56c huge use of weakrefs to remove memoryleaks due to circular references 2013-08-27 11:39:32 +02:00
Emmanuel Garette 0bc47b1cf9 ConstError in tiramisu/error.py
storage_type is now unique
rename _const => _NameSpace
can change storage's options in set_storage

storage :
add Setting object in storage
rename enumerate to list_sessions
rename delete to delete_session
auto-create owner when load sqlite3 storage and in getowner
2013-08-26 21:48:42 +02:00
Emmanuel Garette dc2c173b44 revert change in append of Multi object for sqlite3 storage 2013-08-25 20:51:29 +02:00
Emmanuel Garette 36ed6f874f add some tests for values
cannot use __setitem__ to set value for an option
in append, len should not greater than master option
2013-08-25 18:06:07 +02:00
Emmanuel Garette f482737a47 add test to known if has a value + some corrections 2013-08-24 23:10:35 +02:00
Emmanuel Garette 1ddd88fc99 some corrections in sqlite3 storage 2013-08-21 23:21:28 +02:00
Emmanuel Garette b6bb685ca5 key is now always path and change opt by path dictionary storage 2013-08-21 22:21:50 +02:00
gwen acca6d5a27 documentation update and docstrings 2013-08-21 17:21:09 +02:00
gwen 7d2449380c documentation and docstring updates 2013-08-21 14:52:48 +02:00
gwen a431b46fb9 Merge branch 'master' of ssh://git.labs.libre-entreprise.org/gitroot/tiramisu 2013-08-21 11:10:15 +02:00
gwen defae40a2f documentation update and docstrings 2013-08-21 11:09:11 +02:00
Emmanuel Garette 0d5a447eb3 add persistent option for db 2013-08-20 22:45:11 +02:00
Emmanuel Garette ace7f6f828 merge from master 2013-08-20 16:33:32 +02:00
gwen 564fecc261 pep 8 lines too long 2013-08-20 12:08:02 +02:00
Emmanuel Garette e826f3d1c6 we can personalise storage easily 2013-08-20 09:47:12 +02:00
Emmanuel Garette df7d6759cd add sqlite plugin 2013-08-19 11:01:21 +02:00
Emmanuel Garette f6f709f83d split cache/value/setting in plugin 2013-08-14 23:06:31 +02:00
Emmanuel Garette 8056387f02 return true error message when validation 2013-07-17 20:48:46 +02:00
Emmanuel Garette 4d15c91383 symlink support for getowner and raise if option in master/slave 2013-06-13 22:06:49 +02:00
Emmanuel Garette fd02a954ca add sort, reverse, insert and extend in Multi 2013-06-12 22:48:22 +02:00
Emmanuel Garette 0d114001f4 Works callback/multi/master-slave
- in multi, never modify _default value
- _reset slave when _reset master
- if append None in master with callback return not a list, replace None by the value
- list support in slave
2013-06-12 10:22:50 +02:00
Emmanuel Garette b2538f6f0b support of non multi variable 2013-06-11 15:31:20 +02:00
Emmanuel Garette 6d1cf308b2 Better support for slave with callback:
- callback must return single value, not a list
- if default value, append slave values with master len
- if not default and append, set default value
2013-06-11 15:12:31 +02:00
gwen 9cf30d214d raise ConfigError 2013-06-10 17:12:57 +02:00
gwen c6c422f472 docstrings and api 2013-05-23 17:51:50 +02:00
gwen 879a415e75 add docstrings 2013-05-23 14:55:52 +02:00
Emmanuel Garette 1d8c248d1b Multi: don't touch slave's value if it's default one's + don't check slave properties (if, for example, disabled for example) 2013-05-21 11:09:09 +02:00
Emmanuel Garette 536eb27904 multi, None and validation 2013-05-10 22:34:07 +02:00
Emmanuel Garette fa5d643aee tiramisu/autolib.py: optimpl_ => impl_
tiramisu/option.py: consistency simplication and allow multi
tiramisu/option.py: don't touch cache if force_permissive or force_properties
tiramisu/values.py: set validate paramaters in Multi()
2013-05-10 15:10:06 +02:00
Emmanuel Garette 6de65859b4 * config herite from BaseInformation class
* _cfgimpl_ => _impl_
* optimpl_ => impl_
* properties/permissives are now set/frozenset
* validation raise ValueError if not valid, didn't return anything otherwise
* consistencies are now validate in setting and when deleting value
* ip/network with netmask consistency now works
* DomainnameOption now works
* if no validation, don't set cache for value
* symlinkoption: remove path (not used)
2013-05-08 18:14:42 +02:00
Emmanuel Garette 2d57ed160e work on MetaConfig 2013-05-02 11:34:57 +02:00
Emmanuel Garette 2e21f13387 force_store_value store value but not in write mode 2013-04-23 16:43:39 +02:00
Emmanuel Garette 7cd44d6886 remove an unused callback in test 2013-04-23 11:41:16 +02:00
Emmanuel Garette 20fe56e03d tiramisu/values: _empty should not validate with defaultvalue, defaultvalue is already in value 2013-04-23 10:41:47 +02:00
Emmanuel Garette e883e5b89e remove _setoption in SymLinkOption
objimpl_ => optimpl_
ConflictConfigError => ConflictError
add read_write/read_only/getowner in Config
2013-04-22 09:19:05 +02:00
Emmanuel Garette 682d9fe207 add option name's validation and rename Option method with objimpl_ 2013-04-20 21:58:52 +02:00
Emmanuel Garette d4ef47759e Manipulate properties is now more convenient:
c.cfgimpl_get_settings().has_property('hidden') => 'hidden' in c.cfgimpl_get_settings()
c.cfgimpl_get_settings().has_property('hidden', option1) => 'frozen' in c.cfgimpl_get_settings()[opt]

c.cfgimpl_get_settings().get_properties(option1) => c.cfgimpl_get_settings()[option1]
c.cfgimpl_get_settings().get_properties(option1) => c.cfgimpl_get_settings()[option1]

c.cfgimpl_get_settings().add_property('hidden', option1) => c.cfgimpl_get_settings()[optiont1].append('hidden')
c.cfgimpl_get_settings().del_property('hidden', option1) => c.cfgimpl_get_settings()[optiont1].remove('hidden')

c.cfgimpl_get_settings().enable_property('hidden') => c.cfgimpl_get_settings().append('hidden')
c.cfgimpl_get_settings().disable_property('hidden') => c.cfgimpl_get_settings().remove('hidden')
2013-04-20 17:30:05 +02:00
Emmanuel Garette 54fe8d0f4b cache for properties is now in get_properties and not for validate_properties 2013-04-20 11:25:14 +02:00
Emmanuel Garette a11768ef43 remove expired cache with config.cfgimpl_reset_cache(True) 2013-04-19 22:42:33 +02:00
Emmanuel Garette d7b5d9dc16 add SlaveError for slave's length 2013-04-19 20:23:34 +02:00
Emmanuel Garette 410add6a2a add SlaveError for slave's length 2013-04-19 20:10:55 +02:00
Emmanuel Garette e08bd93cd8 all multi gestion is now in Multi 2013-04-18 23:06:14 +02:00
Emmanuel Garette 324c3d2cf6 * to "reset" a value, now you just have to delete it
config.unwrap_from_path("string").reset(config) => del(config.string)
* add cache for value/setting to 5 secds
to "reset" cache just do: config.cfgimpl_clean_cache()
* can desactivate cache by removing "expire" property
2013-04-18 20:26:40 +02:00
Emmanuel Garette d5e1cb6576 pass force_properties to value's _setitem and remove config's setoption 2013-04-17 23:19:53 +02:00
Emmanuel Garette eea96cc3d1 MultiTypeError => ValueError 2013-04-17 21:57:06 +02:00
Emmanuel Garette 3170237c8e properties validation not in setting and now launch when modify multi 2013-04-17 21:33:34 +02:00
Emmanuel Garette 656b751995 mandatory is a true property (no more MandatoryError) + tests 2013-04-16 22:44:16 +02:00
Emmanuel Garette 6097f3af84 only catch PropertiesOptionError 2013-04-16 12:04:20 +02:00
Emmanuel Garette 90999585fa auto_store_value => force_store_value 2013-04-16 11:30:02 +02:00
Emmanuel Garette 447c175b6a Add "force_store_value" property. If set, store, for example, calculated value as owner values.
So calculated value are calculate only one time.
2013-04-16 09:45:42 +02:00
Emmanuel Garette 9357b342c1 review exception 2013-04-14 12:01:32 +02:00
Emmanuel Garette 9644dd3661 add gettext support 2013-04-13 23:09:05 +02:00
Emmanuel Garette 9c2dcc164c attribute in Option now starts with '_'
add ValidateError
add consistancies in Option
remove byattr in find
2013-04-13 22:50:55 +02:00
Emmanuel Garette 26568dc45a Values validate now value 2013-04-11 11:30:58 +02:00
Emmanuel Garette 0c5ab9df18 don't launch apply_requires more than needed 2013-04-08 16:12:23 +02:00
Emmanuel Garette 67e67a5020 NoValueReturn is not needed now + apply_requires is now in settings 2013-04-08 16:05:56 +02:00
Emmanuel Garette e9902d8ce2 rewrite make_dict 2013-04-04 11:24:00 +02:00
Emmanuel Garette 6105191d9c tiramisu/value.py : self.opt => opt + disable permissive in read_write mode 2013-04-03 17:05:41 +02:00
Emmanuel Garette e6f00948f3 optimisations and all is properties 2013-04-03 12:20:26 +02:00
gwen 8181d1b596 build cache builds correctly now 2013-03-27 17:01:20 +01:00
Emmanuel Garette 39c8e2eb0b add import and name => opt._name 2013-03-25 11:45:21 +01:00
Emmanuel Garette 9b3eb33d27 generate correct len for slave if no value 2013-03-06 17:17:33 +01:00
gwen c40d33fec3 type shall not be a list 2013-02-27 08:50:41 +01:00
gwen 1f1e5e5d26 type shall not be a list 2013-02-26 17:04:41 +01:00
gwen e515ec145d type shall not be a list 2013-02-26 16:58:44 +01:00
gwen 151bc83ba5 previous value api 2013-02-26 14:56:15 +01:00
gwen 762b0e9c69 is_empty 2013-02-26 14:31:45 +01:00
gwen a02cb26d5f masterlen > instead of != 2013-02-25 15:52:10 +01:00
gwen ea7d297c9b private method _get_multitype() 2013-02-25 15:12:09 +01:00
gwen 77633c84ce private method _get_multitype() 2013-02-25 14:27:12 +01:00
gwen 7b4f3b5d36 option's name shall not have an api's method name 2013-02-25 11:33:20 +01:00
gwen 8f4efe6b00 add masters/slaves in the Values() 2013-02-22 11:09:17 +01:00
gwen e6d5d349c8 refactoring values 2013-02-21 17:07:00 +01:00
gwen a8e6bac87f refactoring, the values are in an OptionValues object 2013-02-08 11:50:22 +01:00
gwen 9259a6e3f7 values are in value objects now 2013-02-07 16:20:21 +01:00