candv: Constants & Values¶
candv stands for Constants & Values. It is a little Python library which provides an easy way for creating complex constants.
Changelog¶
You can click a version name to see a diff with the previous one.
1.2.0 (Oct 11, 2014)
- Core classes were significantly refactored.
- constant_class uses Constant as default value (instead of None, see Custom containers for more info).
- Support of groups was reimplemented: now they are classes just as other constants containers (earlier groups were instances of patched containers). So, groups automatically gain all those attributes and methods which usual containers have.
- Constant’s container attribute was made public. Groups of constants now have it too (see Hierarchies).
- API of containers was made really close to API of Python’s dict
(see usage for more info):
- __getitem__, __contains__, __len__ and __iter__ magic methods were implemented;
- contains method was renamed to has_name;
- get_by_name method was removed in favor of __getitem__ method.
- get method with support of default value was introduced.
- All objects (contaners, groups and constants) now have name and full_name attributes. This may be useful if you use names of constants as key values (e.g. for Redis).
- Also, all objects have good repr now.
- Mixin factory with_constant_class() was introduced. It may help you to define more readable containers.
- A potential bug of uninitialized unbounded constants was fixed. Unbounded constant is an instance of a class which is differ from container’s constant_class or its subclasses. This is unnatural case, but if you really need it, it will not break now.
- Exception messages are more informative now.
- Tests were moved out the package.
- Introductory documentation was improved. Other docs were updated too.
1.1.2 (Jul 6, 2014)
- add values and itervalues attributes to ConstantsContainer.
1.1.1 (Jun 21, 2014)
- switch license from GPLv2 to LGPLv3.
1.1.0 (Jun 21, 2014)
- remove Choices container, move it to django-candv-choices library;
- update docs and fix typos;
- strip utils from requirements.
- 1.0.0 (Apr 15, 2014)
Initial version.
Authors¶
Alexander Oblovatniy (@oblalex) created candv and these fine people have contributed.