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.3.1 (Aug 1, 2015)
- Fix the way constants are compared. Now comparison is based on constant’s
full_name
attribute (issue #11).
- Fix the way constants are compared. Now comparison is based on constant’s
1.3.0 (Dec 31, 2014)
- Implement
to_primitive()
method, which can be used for serialization, for example, into JSON (issue #1). See usage and customization for more info.
- Implement
1.2.0 (Oct 11, 2014)
- Core classes were significantly refactored.
constant_class
usesConstant
as default value (instead ofNone
, 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 tohas_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
andfull_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
anditervalues
attributes toConstantsContainer
.
- add
1.1.1 (Jun 21, 2014)
- switch license from
GPLv2
toLGPLv3
.
- switch license from
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.
- remove
- 1.0.0 (Apr 15, 2014)
Initial version.
Authors¶
Alexander Oblovatniy (@oblalex) created candv
and
these fine people have contributed.