Colander
========
.. image:: https://img.shields.io/pypi/v/colander.svg
:target: https://pypi.python.org/pypi/colander
.. image:: https://github.com/Pylons/colander/actions/workflows/ci-tests.yml/badge.svg?branch=main
:target: https://github.com/Pylons/colander/actions/workflows/ci-tests.yml?query=branch%3Amain
.. image:: https://readthedocs.org/projects/colander/badge/?version=latest
:target: https://readthedocs.org/projects/colander/?badge=latest
:alt: Documentation Status
An extensible package which can be used to:
- deserialize and validate a data structure composed of strings,
mappings, and lists.
- serialize an arbitrary data structure to a data structure composed
of strings, mappings, and lists.
It is tested on Python 3.7, 3.8, 3.9, 3.10, and 3.11, and PyPy 3.8.
Please see https://docs.pylonsproject.org/projects/colander/en/latest/
for documentation.
See https://github.com/Pylons/colander for in-development version.
2.0 (2022-01-02)
================
- Drop support for Python 2.7, 3.4, 3.5, 3.6.
- Add support for Python 3.10, 3.11.
- **[breaking]** If a ``bytes`` object is serialized by a ``String`` schema
node with the ``encoding`` parameter specified, it will be passed through
directly to ``str`` first, causing it to come out with a ``b''`` prefix. In
order to serialize it properly, it should be decoded to a string first.
Previously, when the ``encoding`` parameter was specified it would be decoded
and re-encoded, effectively passing it through untouched, despite not being a
string type.
- Add a new ``colander.DataURL`` validator.
See https://github.com/Pylons/colander/pull/348
- Add IDN support to ``colander.url``.
See https://github.com/Pylons/colander/pull/352
- ``colander.All`` now supports ``colander.Invalid.msg`` being ``None`` or a
list, otherwise ``colander.Invalid.asdict`` crashes with
``TypeError: sequence item 1: expected str instance, NoneType found``.
See https://github.com/Pylons/colander/pull/333 and
https://github.com/Pylons/colander/issues/194
- Fixed an issue with ``colander.Mapping`` and ``colander.Sequence``
where a ``default`` value of ``drop`` caused missing values to be dropped
during deserialization. (Only ``missing`` values should affect
deserialization, and only ``default`` values should affect serialization.)
Added many new test cases for ``MappingSchema`` and ``SequenceSchema``.
See https://github.com/Pylons/colander/pull/264
- Remove the dependency on ``setuptools`` for resolving pkg_resources-style
importable paths in ``colander.GlobalObject``.
- Refresh localization files with Babel 2.11.
1.8.3 (2020-11-28)
==================
- Add support for Python 3.9.
- Fix handling of ``insert_before`` on deferred nodes so that it inserts the
new node before the specified node instead of always appending to the end of
``node.children`` after binding.
1.8.2 (2020-08-07)
==================
- Fix the broken wheels in 1.8.1 and 1.8.0 to include the locale data. **sigh**
1.8.1 (2020-08-06)
==================
- Fix the broken wheels in 1.8.0 to include the locale data.
1.8.0 (2020-08-05)
==================
- Drop support for Python 3.4.
- Add support for Python 3.7 and 3.8.
- Fix deserializer on ``Date`` and ``DateTime`` fields to correctly catch
``ValueError`` and ``TypeError`` exception, which can arise when using custom
formats on the field. Instead of allowing these exceptions to propagate,
replace then with an ``Invalid`` exception instead.
See https://github.com/Pylons/colander/pull/338
1.7.0 (2019-02-01)
==================
- The URL validator regex has been updated to no longer be vulnerable to a
catastrophic backtracking that would have led to an infinite loop. See
https://github.com/Pylons/colander/pull/323 and
https://github.com/Pylons/colander/issues/290. With thanks to Przemek
(https://github.com/p-m-k).
This does change the behaviour of the URL validator and it no longer supports
``file://`` URI scheme (https://tools.ietf.org/html/rfc8089). Users that
wish to validate ``file://`` URI's should change their validator to use
``colander.file_uri`` instead.
It has also dropped support for alternate schemes outside of http/ftp (and
their secure equivelants). Please let us know if we need to relax this
requirement.
CVE-ID: CVE-2017-18361
- The Email validator has been updated to use the same regular expression that
is used by the WhatWG HTML specification, thereby increasing the email
addresses that will validate correctly from web forms submitted. See
https://github.com/Pylons/colander/pull/324 and
https://github.com/Pylons/colander/issues/283
- Number once again will allow you to serialize None to colander.null, this
reverts an accidental revert. See
https://github.com/Pylons/colander/issues/204#issuecomment-459556100
- Integer SchemaType now supports an optional ``strict`` mode that will
validate that the number is an integer, rather than silently accepting floats
and truncating. See https://github.com/Pylons/colander/pull/322 and
https://github.com/Pylons/colander/issues/292
1.6.0 (2019-01-31)
==================
- Support custom format strings on ``DateTime`` and ``Date`` fields.
See https://github.com/Pylons/colander/pull/318
- Support sub-second precision on ``Time`` fields if provided.
See https://github.com/Pylons/colander/pull/319
- Format Python code of ``colander`` to conform to the PEP 8 style guide.
Add some linters (``flake8``, ``black`` and other) into ``tox.ini``.
See https://github.com/Pylons/colander/pull/320
1.5.1 (2018-09-10)
==================
- Support deserializing ``colander.drop`` and ``colander.required``.
See https://github.com/Pylons/colander/pull/304
1.5.0 (2018-09-07)
==================
- Drop Python 3.3 support. Add PyPy3 and Python 3.7 as allowed failures.
See https://github.com/Pylons/colander/pull/309
- Fix email validation to not allow all ASCII characters between + and /.
This prevents email addresses like 'foo1,foo2@bar.baz' from being validated,
which would be handled as multiple email addresses by subsequent tools.
See https://github.com/Pylons/colander/pull/315
- Add support for ``enum.Enum`` objects.
See https://github.com/Pylons/colander/pull/305
- Recompiled language translations and updated ``de`` and ``el`` locales.
See https://github.com/Pylons/colander/pull/284 and
https://github.com/Pylons/colander/pull/314
1.4.0 (2017-07-31)
==================
- Remove the ``colander.iso8601`` backward-compatibility module, broken
by recent updates to the actual ``iso8601`` package which backed it.
Downstream libraries can just mechanically adjust imports to use
``iso8601.iso8601`` instead of ``colander.iso8601``.
See https://github.com/Pylons/colander/pull/296
1.3.3 (2017-04-25)
==================
- Add "zh_Hant", traditional chinese translations, and rename simplified
chinese from "zh" to "zh_Hans".
See https://github.com/Pylons/colander/pull/285
- Improve serialization of class objects using ``colander.GlobalObject``.
See https://github.com/Pylons/colander/pull/288
1.3.2 (2017-01-31)
==================
- Python 3.6 support.
- Allow deferred schema nodes.
See https://github.com/Pylons/colander/pull/280
- Fix an issue when using a node multiple times in a schema by cloning it.
See https://github.com/Pylons/colander/issues/279
- Fix a regression that broke ``SequenceSchema.clone``.
See https://github.com/Pylons/colander/pull/275
- Update german translations.
See https://github.com/Pylons/colander/pull/273
- Recompile language files.
See https://github.com/Pylons/colander/pull/270
1.3.1 (2016-05-23)
==================
- 1.3 was released without updating the changelog. This release fixes that.
1.3 (2016-05-23)
================
- Drop Python 2.6 and PyPy3 from the test suite. They are no longer
supported. See https://github.com/Pylons/colander/pull/263
- ``colander.String`` schema type now supports an optional keyword argument
``allow_empty`` which, when True, deserializes an empty string to an
empty string. When False (default), an empty string deserializes to
``colander.null``. This allows for a node to be explicitly required, but
allow an empty ('') value to be provided.
https://github.com/Pylons/colander/pull/199
- Add ``separator`` parameter to ``colander.Invalid.asdict``
(for backward compatibility, default is '; ').
See https://github.com/Pylons/colander/pull/253
- Fixed an issue with ``SchemaNode.clone`` where it would fail when
cloning an instance of ``colander.SequenceSchema`` due to initializing
the schema without any children, violating some checks.
See https://github.com/Pylons/colander/pull/212
1.2 (2016-01-18)
================
Features
--------
- Add new exception ``UnsupportedFields``. Used to pass to the caller a list
of extra fields detected in a cstruct during deserialize.
See https://github.com/Pylons/colander/pull/241
- Add ``drop`` functionality to ``Sequence`` type.
See https://github.com/Pylons/colander/pull/225
Bug Fixes
---------
- ``SchemaNode`` will no longer assume the first argument to the constructor
is the schema type. This allows it to properly fallback to using the
``schema_type`` class attribute on subclasses even when using the
imperative API to pass options to the constructor.
- Fix a bug in which ``MappingSchema``, ``SequenceSchema`` and
``TupleSchema`` would always treat the first arg as the schema type. This
meant that it would fail if passed only nodes to the constructor despite
the default type being implied by the name. It is now possible to do
``MappingSchema(child1, child2, ...)`` instead of
``MappingSchema(Mapping(), child1, child2)``.
Translations
------------
- Added Finnish translations: ``fi``
See https://github.com/Pylons/colander/pull/243
1.1 (2016-01-15)
================
Platform
--------
- Add explicit support for Python 3.4, Python 3.5 and PyPy3.
Features
--------
- Add ``min_err`` and ``max_err`` arguments to ``Length``, allowing
customization of its error messages.
- Add ``colander.Any`` validator: succeeds if at least one of its
subvalidators succeeded.
- Allow localization of error messages returned by ``colander.Invalid.asdict``
by adding an optional ``translate`` callable argument.
- Add a ``missing_msg`` argument to ``SchemaNode``, allowing customization
of the error message used when the node is required and missing.
- Add ``NoneOf`` validator which succeeds if the value is none of the choices.
- Add ``normalize`` option to ``Decimal``, stripping the rightmost
trailing zeros.
Bug Fixes
---------
- Fix an issue where the ``flatten()`` method produces an invalid name
(ex: "answer.0.") for the type ``Sequence``. See
https://github.com/Pylons/colander/issues/179
- Fixed issue with ``String`` not being properly encoded when non-string
values were passed into ``serialize()``
See `#235 <https://github.com/Pylons/colander/pull/235>`_
- ``title`` was being overwritten when made a child through defining a schema
as a class. See https://github.com/Pylons/colander/pull/239
Translations
------------
- Added new translations: ``el``
- Updated translations: ``fr``, ``de``, ``ja``
1.0 (2014-11-26)
================
Backwards Incompatibilities
---------------------------
- ``SchemaNode.deserialize`` will now raise an
``UnboundDeferredError`` if the node has an unbound deferred
validator. Previously, deferred validators were silently ignored.
See https://github.com/Pylons/colander/issues/47
Bug Fixes
---------
- Removed forked ``iso8601`` and change to dependency on PyPI ``iso8601``
(due to float rounding bug on microsecond portion when parsing
iso8601 datetime string). Left an ``iso8601.py`` stub for backwards
compatibility.
- Time of "00:00" no longer gives ``colander.Invalid``.
- Un-break wrapping of callable instances as ``colander.deferred``.
See https://github.com/Pylons/colander/issues/141.
- Set the max length TLD to 22 in ``Email`` validator based on the
current list of valid TLDs.
See https://github.com/Pylons/colander/issues/159
- Fix an issue where ``drop`` was not recognized as a default and was
returning the ``drop`` instance instead of omitting the value.
https://github.com/Pylons/colander/issues/139
- Fix an issue where the ``SchemaNode.title`` was clobbered by the ``name``
when defined as a class attribute.
See https://github.com/Pylons/colander/pull/183 and
https://github.com/Pylons/colander/pull/185
Translations
------------
- Updated translations: ``fr``, ``de``, ``ja``
1.0b1 (2013-09-01)
==================
Bug Fixes
---------
- In 1.0a1, there was a change merged from
https://github.com/Pylons/colander/pull/73 which made it possible to supply
``None`` as the ``default`` value for a String type, and upon serialization,
the value would be rendered as ``colander.null`` if the default were used.
This confused people who were actually supplying the value ``None`` as a
default when the associated appstruct had no value, so the change has been
reverted. When you supply ``None`` as the ``default`` argument to a String,
the rendered serialize() value will again be ``'None'``. Sorry.
- Normalize ``colander.Function`` argument ``message`` to be ``msg``. This now
matches other APIs within Colander. The ``message`` argument is now
deprecated and a warning will be emitted.
https://github.com/Pylons/colander/issues/31
https://github.com/Pylons/colander/issues/64
- ``iso8601.py``: Convert ``ValueError`` (raised by ``datetime``) into
``ParseErrorr`` in ``parse_date``, so that the validation machinery
upstream handles it properly.
- ``iso8601.py``: Correctly parse datetimes with a timezone of Z even
when the default_timezone is set. These previously had the default
timezone.
- ``colander.String`` schema type now raises ``colander.Invalid`` when trying
to deserialize a non-string item.
See https://github.com/Pylons/colander/issues/100
Features
--------
- Add ``colander.List`` type, modeled on ``deform.List``: this type
preserves ordering, and allows duplicates.
- It is now possible to use the value ``colander.drop`` as the ``default``
value for items that are subitems of a mapping. If ``colander.drop`` is used
as the ``default`` for a subnode of a mapping schema, and the mapping
appstruct being serialized does not have a value for that schema node, the
value will be omitted from the serialized mapping. For instance, the
following script, when run would not raise an assertion error::
class What(colander.MappingSchema):
thing = colander.SchemaNode(colander.String(), default=colander.drop)
result = What().serialize({}) # no "thing" in mapping
assert result == {}
- The ``typ`` of a ``SchemaNode`` can optionally be pased in as a keyword
argument. See https://github.com/Pylons/colander/issues/90
- Allow interpolation of `missing_msg` with properties `title` and `name`
1.0a5 (2013-05-31)
==================
- Fix bug introduced by supporting spec-mandated truncations of ISO-8601
timezones. A TypeError would be raised instead of Invalid. See
https://github.com/Pylons/colander/issues/111.
1.0a4 (2013-05-21)
==================
- Loosen Email validator regex (permit apostrophes, bang, etc in localpart).
- Allow for timezone info objects to be pickled and unpickled "more correctly"
(Use '__getinitargs__' to provide unpickling-only defaults). See
https://github.com/Pylons/colander/pull/108.
1.0a3 (2013-05-16)
==================
Features
--------
- Support spec-mandated truncations of ISO-8601 timezones.
- Support spec-mandated truncations of ISO-8601 datetimes.
- Allow specifying custom representations of values for boolean fields.
Bug Fixes
---------
- Ensure that ``colander.iso8601.FixedOffset`` instances can be unpickled.
- Avoid validating strings as sequences under Py3k.
- Sync documentation with 0.9.9 change to use ``insert_before`` rather than
``schema_order``. See https://github.com/Pylons/colander/issues/104
1.0a2 (2013-01-30)
==================
Features
--------
- Add ``colander.ContainsOnly`` and ``colander.url`` validators.
- Add ``colander.instantiate`` to help define schemas containing
mappings and sequences more succinctly.
1.0a1 (2013-01-10)
==================
Bug Fixes
---------
- Work around a regression in Python 3.3 for ``colander.Decimal`` when it's
used with a ``quant`` argument but without a ``rounding`` argument.
See https://github.com/Pylons/colander/issues/66
- Using ``SchemaNode(String, default='', ..)`` now works properly, or at least
more intuitively. Previously if an empty-string ``default`` was supplied,
serialization would return a defaulted value as ``colander.null``. See
https://github.com/Pylons/colander/pull/73.
- Stricter checking in colander.Mapping to prevent items which are logically
not mappings from being accepted during validation (see
https://github.com/Pylons/colander/pull/96).
Features
--------
- Add ``colander.Set`` type, ported from ``deform.Set``
- Add Python 3.3 to tox configuration and use newer tox testing regime
(setup.py dev).
- Add Python 3.3 Trove classifier.
- Calling ``bind`` on a schema node e.g. ``cloned_node = somenode.bind(a=1,
b=2)`` on a schema node now results in the cloned node having a
``bindings`` attribute of the value ``{'a':1, 'b':2}``.
- It is no longer necessary to pass a ``typ`` argument to a SchemaNode
constructor if the node class has a ``schema_type`` callable as a class
attribute which, when called with no arguments, returns a schema type.
This callable will be called to obtain the schema type if a ``typ`` is not
supplied to the constructor. The default ``SchemaNode`` object's
``schema_type`` callable raises a ``NotImplementedError`` when it is
called.
- SchemaNode now has a ``raise_invalid`` method which accepts a message and
raises a colander.Invalid exception using ``self`` as the node and the
message as its message.
- It is now possible and advisable to subclass ``SchemaNode`` in order to
create a bundle of default node behavior. The subclass can define the
following methods and attributes: ``preparer``, ``validator``, ``default``,
``missing``, ``name``, ``title``, ``description``, ``widget``, and
``after_bind``.
For example, the older, more imperative style that looked like this still
works, of course::
from colander import SchemaNode
ranged_int = colander.SchemaNode(
validator=colander.Range(0, 10),
default = 10,
title='Ranged Int'
)
But you can alternately now do something like this::
from colander import SchemaNode
class RangedIntSchemaNode(SchemaNode):
validator = colander.Range(0, 10)
default = 10
title = 'Ranged Int'
ranged_int = RangedInt()
Values that are expected to be callables can now alternately be methods of
the schemanode subclass instead of plain attributes::
from colander import SchemaNode
class RangedIntSchemaNode(SchemaNode):
default = 10
title = 'Ranged Int'
def validator(self, node, cstruct):
if not 0 < cstruct < 10:
raise colander.Invalid(node, 'Must be between 0 and 10')
ranged_int = RangedInt()
Note that when implementing a method value such as ``validator`` that
expects to receive a ``node`` argument, ``node`` must be provided in the
call signature, even though ``node`` will almost always be the same as
``self``. This is because Colander simply treats the method as another
kind of callable, be it a method, or a function, or an instance that has a
``__call__`` method. It doesn't care that it happens to be a method of
``self``, and it needs to support callables that are not methods, so it
sends ``node`` in regardless.
You can't currently use *method* definitions as ``colander.deferred``
callables. For example this will *not* work::
from colander import SchemaNode
class RangedIntSchemaNode(SchemaNode):
default = 10
title = 'Ranged Int'
@colander.deferred
def validator(self, node, kw):
request = kw['request']
def avalidator(node, cstruct):
if not 0 < cstruct < 10:
if request.user != 'admin':
raise colander.Invalid(node, 'Must be between 0 and 10')
return avalidator
ranged_int = RangedInt()
bound_ranged_int = ranged_int.bind(request=request)
This will result in::
TypeError: avalidator() takes exactly 3 arguments (2 given)
However, if you treat the thing being decorated as a function instead of a
method (remove the ``self`` argument from the argument list), it will
indeed work)::
from colander import SchemaNode
class RangedIntSchemaNode(SchemaNode):
default = 10
title = 'Ranged Int'
@colander.deferred
def validator(node, kw):
request = kw['request']
def avalidator(node, cstruct):
if not 0 < cstruct < 10:
if request.user != 'admin':
raise colander.Invalid(node, 'Must be between 0 and 10')
return avalidator
ranged_int = RangedInt()
bound_ranged_int = ranged_int.bind(request=request)
In previous releases of Colander, the only way to defer the computation of
values was via the ``colander.deferred`` decorator. In this release,
however, you can instead use the ``bindings`` attribute of ``self`` to
obtain access to the bind parameters within values that are plain old
methods::
from colander import SchemaNode
class RangedIntSchemaNode(SchemaNode):
default = 10
title = 'Ranged Int'
def validator(self, node, cstruct):
request = self.bindings['request']
if not 0 < cstruct < 10:
if request.user != 'admin':
raise colander.Invalid(node, 'Must be between 0 and 10')
ranged_int = RangedInt()
bound_range_int = ranged_int.bind(request=request)
If the things you're trying to defer aren't callables like ``validator``,
but they're instead just plain attributes like ``missing`` or ``default``,
instead of using a ``colander.deferred``, you can use ``after_bind`` to set
attributes of the schemanode that rely on binding variables::
from colander import SchemaNode
class UserIdSchemaNode(SchemaNode):
title = 'User Id'
def after_bind(self, node, kw):
self.default = kw['request'].user.id
You can override the default values of a schemanode subclass in its
constructor::
from colander import SchemaNode
class RangedIntSchemaNode(SchemaNode):
default = 10
title = 'Ranged Int'
validator = colander.Range(0, 10)
ranged_int = RangedInt(validator=colander.Range(0, 20))
In the above example, the validation will be done on 0-20, not 0-10.
If a schema node name conflicts with a schema value attribute name on the
same class, you can work around it by giving the schema node a bogus name
in the class definition but providing a correct ``name`` argument to the
schema node constructor::
from colander import SchemaNode, Schema
class SomeSchema(Schema):
title = 'Some Schema'
thisnamewillbeignored = colander.SchemaNode(
colander.String(),
name='title'
)
Note that such a workaround is only required if the conflicting names are
attached to the *exact same* class definition. Colander scrapes off schema
node definitions at each class' construction time, so it's not an issue for
inherited values. For example::
from colander import SchemaNode, Schema
class SomeSchema(Schema):
title = colander.SchemaNode(colander.String())
class AnotherSchema(SomeSchema):
title = 'Some Schema'
schema = AnotherSchema()
In the above example, even though the ``title = 'Some Schema'`` appears to
override the superclass' ``title`` SchemaNode, a ``title`` SchemaNode will
indeed be present in the child list of the ``schema`` instance
(``schema['title']`` will return the ``title`` SchemaNode) and the schema's
``title`` attribute will be ``Some Schema`` (``schema.title`` will return
``Some Schema``).
Normal inheritance rules apply to class attributes and methods defined in
a schemanode subclass. If your schemanode subclass inherits from another
schemanode class, your schemanode subclass' methods and class attributes
will override the superclass' methods and class attributes.
Ordering of child schema nodes when inheritance is used works like this:
the "deepest" SchemaNode class in the MRO of the inheritance chain is
consulted first for nodes, then the next deepest, then the next, and so on.
So the deepest class' nodes come first in the relative ordering of schema
nodes, then the next deepest, and so on. For example::
class One(colander.Schema):
a = colander.SchemaNode(
colander.String(),
id='a1',
)
b = colander.SchemaNode(
colander.String(),
id='b1',
)
d = colander.SchemaNode(
colander.String(),
id='d1',
)
class Two(One):
a = colander.SchemaNode(
colander.String(),
id='a2',
)
c = colander.SchemaNode(
colander.String(),
id='c2',
)
e = colander.SchemaNode(
colander.String(),
id='e2',
)
class Three(Two):
b = colander.SchemaNode(
colander.String(),
id='b3',
)
d = colander.SchemaNode(
colander.String(),
id='d3',
)
f = colander.SchemaNode(
colander.String(),
id='f3',
)
three = Three()
The ordering of child nodes computed in the schema node ``three`` will be
``['a2', 'b3', 'd3', 'c2', 'e2', 'f3']``. The ordering starts ``a1``,
``b1``, ``d1`` because that's the ordering of nodes in ``One``, and
``One`` is the deepest SchemaNode in the inheritance hierarchy. Then it
processes the nodes attached to ``Two``, the next deepest, which causes
``a1`` to be replaced by ``a2``, and ``c2`` and ``e2`` to be appended to
the node list. Then finally it processes the nodes attached to ``Three``,
which causes ``b1`` to be replaced by ``b3``, and ``d1`` to be replaced by
``d3``, then finally ``f`` is appended.
Multiple inheritance works the same way::
class One(colander.Schema):
a = colander.SchemaNode(
colander.String(),
id='a1',
)
b = colander.SchemaNode(
colander.String(),
id='b1',
)
d = colander.SchemaNode(
colander.String(),
id='d1',
)
class Two(colander.Schema):
a = colander.SchemaNode(
colander.String(),
id='a2',
)
c = colander.SchemaNode(
colander.String(),
id='c2',
)
e = colander.SchemaNode(
colander.String(),
id='e2',
)
class Three(Two, One):
b = colander.SchemaNode(
colander.String(),
id='b3',
)
d = colander.SchemaNode(
colander.String(),
id='d3',
)
f = colander.SchemaNode(
colander.String(),
id='f3',
)
three = Three()
The resulting node ordering of ``three`` is the same as the single
inheritance example: ``['a2', 'b3', 'd3', 'c2', 'e2', 'f3']`` due to the
MRO deepest-first ordering (``One``, then ``Two``, then ``Three``).
Backwards Incompatibilities
---------------------------
- Passing non-SchemaNode derivative instances as ``*children`` into a
SchemaNode constructor is no longer supported. Symptom: ``AttributeError:
name`` when constructing a SchemaNode.
0.9.9 (2012-09-24)
==================
Features
--------
- Allow the use of ``missing=None`` for Number. See
https://github.com/Pylons/colander/pull/59 .
- Create a ``colander.Money`` type that is a Decimal type with
two-decimal-point precision rounded-up.
- Allow ``quant`` and ``rounding`` args to ``colander.Decimal`` constructor.
- ``luhnok`` validator added (credit card luhn mod10 validator).
- Add an ``insert`` method to SchemaNode objects.
- Add an ``insert_before`` method to SchemaNode objects.
- Better class-based mapping schema inheritance model.
* A node declared in a subclass of a mapping schema superclass now
overrides any node with the same name inherited from any superclass.
Previously, it just repeated and didn't override.
* An ``insert_before`` keyword argument may be passed to a SchemaNode
constructor. This is a string naming a node in a superclass. A node
with an ``insert_before`` will be placed before the named node in a
parent mapping schema.
- The ``preparer=`` argument to SchemaNodes may now be a sequence of
preparers.
- Added a ``cstruct_children`` method to SchemaNode.
- A new ``cstruct_children`` API should exist on schema types. If
``SchemaNode.cstruct_children`` is called on a node with a type that does
not have a ``cstruct_children`` method, a deprecation warning is emitted
and ``[]`` is returned (this may or may not be the correct value for your
custom type).
Backwards Incompatibilities
---------------------------
- The inheritance changes required a minor backwards incompatibility: calling
``__setitem__`` on a SchemaNode will no longer raise ``KeyError`` when
attempting to set a subnode into a node that doesn't already have an
existing subnode by that name. Instead, the subnode will be appended to
the child list.
Documentation
-------------
- A "Schema Inheritance" section was added to the Basics chapter
documentation.
0.9.8 (2012-04-27)
==================
- False evaluating values are now serialized to colander.null for
String, Date, and Time. This resolves the issue where a None value
would be rendered as 'None' for String, and missing='None' was not
possible for Date, Datetime, and Time.
See https://github.com/Pylons/colander/pull/1 .
- Updated Brazilian Portugese translations.
- Updated Japanese translations.
- Updated Russian translations.
- Fix documentation: 0.9.3 allowed explicitly passing None to DateTime
to have no default timezone applied.
- Add ``dev`` and ``docs`` setup.py aliases (e.g. ``python setup.py dev``).
0.9.7 (2012-03-20)
==================
- Using ``schema.flatten(...)`` against a mapping schema node without a name
produced incorrectly dot-prefixed keys. See
https://github.com/Pylons/colander/issues/37
- Fix invalid.asdict for multiple error messages. See
https://github.com/Pylons/colander/pull/22 ,
https://github.com/Pylons/colander/pull/27 ,
https://github.com/Pylons/colander/pull/12 , and
https://github.com/Pylons/colander/issues/2 .
- Invalid.messages() now returns an empty list if there are no messages.
See https://github.com/Pylons/colander/pull/21 .
- ``name`` passed to a SchemaNode constructor was not respected in
declaratively constructed schemas. Now if you pass ``name`` to the
SchemaNode constructor within the body of a schema class, it will take
precedence over the name it's been assigned to in the schema class.
See https://github.com/Pylons/colander/issues/39 .
- Japanese translation thanks to OCHIAI, Gouji.
- Replaced incorrect ``%{err}`` with correct ``${err}`` in String.deserialize
error message. See https://github.com/Pylons/colander/pull/41
0.9.6 (2012-02-14)
==================
- No longer runs on Python 2.4 or 2.5. Python 2.6+ is now required.
- Python 3.2 compatibility.
- Removed a dependency on the iso8601 package (code from the package is now
inlined in Colander itself).
- Added copyright and licensing information for iso8601-derived code to
LICENSE.txt.
0.9.5 (2012-01-13)
==================
- Added Czech translation.
- Compile pt_BR translation (it was previously uncompiled).
- Minor docs fixes.
- Documentation added about flatten and unflatten.
0.9.4 (2011-10-14)
==================
- ``flatten`` now only includes leaf nodes in the flattened dict.
- ``flatten`` does not include a path element for the name of the type node
for sequences.
- ``unflatten`` is implemented.
- Added ``__setitem__`` to ``SchemaNode``, allowing replacement of nodes by
name.
- Added ``get_value`` and ``set_value`` methods to ``Schema`` which allow
access and mutation of appstructs using dotted name paths.
- Add Swedish, French, Chinese translations.
0.9.3 (2011-06-23)
==================
- Add ``Time`` type.
- Add Dutch translation.
- Fix documentation: 0.9.2 requires ``deserialize`` of types to explicitly
deal with the potential to receive ``colander.null``.
- Use ``default_tzinfo`` when deserializing naive datetimes. See
https://github.com/Pylons/colander/pull/5
- Allow ``default_tzinfo`` to be ``None`` when creating a
``colander.DateTime``. See
https://github.com/Pylons/colander/pull/6
- Add the ability to insert a ``colander.interfaces.Preparer`` between
deserialization and validation. See the Preparing section in the
documentation.
0.9.2 (2011-03-28)
==================
- Added Polish translation, thanks to Jedrzej Nowak.
- Moved to Pylons Project GitHub (https://github.com/Pylons/colander).
- Add tox.ini for testing purposes.
- New API: ``colander.required``. Used as the marker value when a
``missing`` argument is left unspecified.
- Bug fix: if a ``title`` argument which is the empty string or ``None`` is
passed explicitly to a SchemaNode, it is no longer replaced by a title
computed from the name.
- Add SchemaNode.__contains__ to support "name in schema".
- SchemaNode deserialization now unconditionally calls the schema type's
``deserialize`` method to obtain an appstruct before attempting to
validate. Third party schema types should now return ``colander.null`` if
passed a ``colander.null`` value or another logically "empty" value as a
cstruct during ``deserialize``.
0.9.1 (2010-12-02)
==================
- When ``colander.null`` was unpickled, the reference created during
unpickling was *not* a reference to the singleton but rather a new instance
of the ``colander._null`` class. This was unintentional, because lots of
code checks for ``if x is colander.null``, which will fail across pickling
and unpickling. Now the reference created when ``colander.null`` is
pickled is unpickled as the singleton itself.
0.9 (2010-11-28)
=================
- SchemaNode constructor now accepts arbitrary keyword arguments. It
sets any unknown values within the ``**kw`` sequence as attributes
of the node object.
- Added Spanish locale: thanks to Douglas Cerna for the translations!
- If you use a schema with deferred ``validator``, ``missing`` or
``default`` attributes, but you use it to perform serialization and
deserialization without calling its ``bind`` method:
- If ``validator`` is deferred, no validation will be performed.
- If ``missing`` is deferred, the field will be considered *required*.
- If ``default`` is deferred, the serialization default will be
assumed to be ``colander.null``.
- Undocumented internal API for all type objects: ``flatten``.
External type objects should now inherit from
``colander.SchemaType`` to get a default implementation.
0.8 (2010/09/08)
=================
- Docstring fixes to ``colander.SchemaNode`` (``missing`` is not the
``null`` value when required, it's a special marker value).
- The concept of "schema binding" was added, which allows for a more
declarative-looking spelling of schemas and schema nodes which have
dependencies on values available after the schema has already been
fully constructed. See the new narrative chapter in the
documentation entitled "Schema Binding".
- The interface of ``colander.SchemaNode`` has grown a ``__delitem__``
method. The ``__iter__``, and ``__getitem__`` methods have now also
been properly documented.
0.7.3 (2010/09/02)
==================
- The title of a schema node now defaults to a titleization of the
``name``. Underscores in the ``name`` are replaced with empty
strings and the first letter of every resulting word is capitalized.
Previously the ``name`` was not split on underscores, and the
entirety of the ``name`` was capitalized.
- A method of the ``colander.Invalid`` exception named ``messages``
was added. It returns an iterable of error messages using the
``msg`` attribute of its related exception node. If the ``msg``
attribute is iterable, it is returned. If it is not iterable, a
single-element list containing the ``msg`` value is returned.
0.7.2 (2010/08/30)
==================
- Add an ``colander.SchemaNode.__iter__`` method, which iterates over
the children nodes of a schema node.
- The constructor of a ``colander.SchemaNode`` now accepts a
``widget`` keyword argument, for use by Deform (it is not used
internally).
0.7.1 (2010/06/12)
==================
- Make it possible to use ``colander.null`` as a ``missing`` argument
to ``colander.SchemaNode`` for roundtripping purposes.
- Make it possible to pickle ``colander.null``.
0.7.0
=====
A release centered around normalizing the treatment of default and
missing values.
Bug Fixes
---------
- Allow ``colander.Regex`` validator to accept a pattern object
instead of just a string.
- Get rid of circular reference in Invalid exceptions: Invalid
exceptions now no longer have a ``parent`` attribute. Instead, they
have a ``positional`` attribute, which signifies that the parent
node type of the schema node to which they relate inherits from
Positional. This attribute isn't an API; it's used only internally
for reporting.
- Raise a ``TypeError`` when bogus keyword arguments are passed to
``colander.SchemaNode``.
Backwards Incompatiblities / New Features
-----------------------------------------
- ``missing`` constructor arg to SchemaNode: signifies
*deserialization* default, disambiguated from ``default`` which acted
as both serialization and deserialization default previously.
Changes necessitated / made possible by SchemaNode ``missing``
addition:
- The ``allow_empty`` argument of the ``colander.String`` type was
removed (use ``missing=''`` as a wrapper SchemaNode argument
instead).
- New concept: ``colander.null`` input to serialization and
deserialization. Use of ``colander.null`` normalizes serialization
and deserialization default handling.
Changes necessitated / made possible by ``colander.null`` addition:
- ``partial`` argument and attribute of colander.MappingSchema has
been removed; all serializations are partial, and partial
deserializations are not necessary.
- ``colander.null`` values are added to the cstruct for partial
serializations instead of omitting missing node values from
the cstruct.
- ``colander.null`` may now be present in serialized and
deserialized data structures.
- ``sdefault`` attribute of SchemaNode has been removed; we never need
to serialize a default anymore.
- The value ``colander.null`` will be passed as ``appstruct`` to
each type's ``serialize`` method when a mapping appstruct doesn't
have a corresponding key instead of ``None``, as was the practice
previously.
- The value ``colander.null`` will be passed as ``cstruct`` to
each type's ``deserialize`` method when a mapping cstruct
doesn't have a corresponding key instead of ``None``, as was the
practice previously.
- Types now must handle ``colander.null`` explicitly during
serialization.
- Updated and expanded documentation, particularly with respect to new
``colander.null`` handling.
- The ``value`` argument to the ``serialize`` method of a SchemaNode
is now named ``appstruct``. It is no longer a required argument; it
defaults to ``colander.null`` now.
The ``value`` argument to the ``deserialize`` method of a SchemaNode
is now named ``cstruct``. It is no longer a required argument; it
defaults to ``colander.null`` now.
- The ``value`` argument to the ``serialize`` method of each built-in
type is now named ``appstruct``, and is now required: it is no
longer a keyword argument that has a default.
The ``value`` argument to the ``deserialize`` method of each
built-in type is now named ``cstruct``, and is now required: it is
no longer a keyword argument that has a default.
0.6.2 (2010-05-08)
==================
- The default ``encoding`` parameter value to the ``colander.String``
type is still ``None``, however its meaning has changed. An
encoding of ``None`` now means that no special encoding and decoding
of Unicode values is done by the String type. This differs from the
previous behavior, where ``None`` implied that the encoding was
``utf-8``. Pass the encoding as ``utf-8`` specifically to get the
older behavior back. This is in support of Deform.
- The default ``err_template`` value attached to the ``colander.Date``
and ``colander.Datetime`` types was changed. It is now simply
``Invalid date`` instead of ``_('${val} cannot be parsed as an
iso8601 date: ${err}')``. This is in support of Deform.
- Fix bug in ``colander.Boolean`` that attempted to call ``.lower`` on
a bool value when a default value was found for the schema node.
0.6.1 (2010-05-04)
==================
- Add a Decimal type (number type which uses ``decimal.Decimal`` as a
deserialization target).
0.6.0 (2010-05-02)
==================
- (Hopefully) fix intermittent datetime-granularity-related test
failures.
- Internationalized error messages. This required some changes to
error message formatting, which may impact you if you were feeding
colander an error message template.
- New project dependency: ``translationstring`` package for
internationalization.
- New argument to ``colander.String`` constructor: ``allow_empty``.
This is a boolean representing whether an empty string is a valid
value during deserialization, defaulting to ``False``.
- Add minimal documentation about the composition of a
colander.Invalid exception to the narrative docs.
- Add (existing, but previously non-API) colander.Invalid attributes
to its interface within the API documentation.
0.5.2 (2010-04-09)
==================
- Add Email and Regex validators (courtesy Steve Howe).
- Raise a ``colander.Invalid`` error if a ``colander.SequenceSchema``
is created with more than one member.
- Add ``Function`` validator.
- Fix bug in serialization of non-Unicode values in the ``String`` class.
- Get rid of ``pserialize`` in favor of making ``serialize`` always
partially serialize.
- Get rid of ``pdeserialize``: it existed only for symmetry. We'll
add something like it back later if we need it.
0.5.1 (2010-04-02)
==================
- The constructor arguments to a the ``colander.Schema`` class are now
sent to the constructed SchemaNode rather than to the type it represents.
- Allow ``colander.Date`` and ``colander.DateTime`` invalid error
messages to be customized.
- Add a ``pos`` argument to the ``colander.Invalid.add`` method.
- Add a ``__setitem__`` method to the ``colander.Invalid`` class.
- The ``colander.Mapping`` constructor keyword argument
``unknown_keys`` has been renamed to ``unknown``.
- Allow ``colander.Mapping`` type to accept a new constructor
argument: ``partial``.
- New interface methods required by types and schema nodes:
``pserialize`` and ``pdeserialize``. These partially serialize or
partially deserialize a value (the definition of "partial" is up to
the type).
0.5 (2010-03-31)
================
- 0.4 was mispackaged (CHANGES.txt missing); no code changes from 0.4
however.
0.4 (2010-03-30)
================
- Add ``colander.DateTime`` and ``colander.Date`` data types.
- Depend on the ``iso8601`` package for date support.
0.3 (2010-03-29)
================
- Subnodes of a schema node are now kept in the ``children`` attribute
rather than the ``nodes`` attribute.
- Add an ``sdefault`` property to ``colander.SchemaNode`` objects.
- Add a ``clone`` method to ``colander.SchemaNode`` objects.
- Add a ``__str__`` method to the ``colander.Invalid`` exception that
prints an error summary.
- Various error message improvements.
- Add ``colander.Length`` validator class.
0.2 (2010-03-23)
================
- Make nodetype overrideable.
- Add __getitem__ to SchemaNode.
- Fix OneOf message.
- Capitalize node titles.
- Deal with empty strings in String, Boolean, and Float types.
- Introduce description; make title the same as name.
- Remove copy method from schemanode.
- Allow schema nodes to have titles.
- The term "structure" is too overloaded to use for schema purposes:
structure -> schema node.
- Make Sequence more like Tuple and Mapping (it uses a substructure
rather than a structure parameter to denote its type).
- Add __repr__ and copy methods to structure.
- Add accept_scalar flag to Sequence.
0.1 (2010-03-14)
================
- Initial release.
Raw data
{
"_id": null,
"home_page": "https://github.com/Pylons/colander",
"name": "colander",
"maintainer": "Pylons Project",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "pylons-discuss@googlegroups.com",
"keywords": "serialize deserialize validate schema validation",
"author": "Agendaless Consulting",
"author_email": "pylons-discuss@googlegroups.com",
"download_url": "https://files.pythonhosted.org/packages/1c/de/cf5f43f6ad702486473a40480d4f36efc03cba29ca372b55d78e9af0f2ca/colander-2.0.tar.gz",
"platform": null,
"description": "Colander\n========\n\n.. image:: https://img.shields.io/pypi/v/colander.svg\n :target: https://pypi.python.org/pypi/colander\n\n.. image:: https://github.com/Pylons/colander/actions/workflows/ci-tests.yml/badge.svg?branch=main\n :target: https://github.com/Pylons/colander/actions/workflows/ci-tests.yml?query=branch%3Amain\n\n.. image:: https://readthedocs.org/projects/colander/badge/?version=latest\n :target: https://readthedocs.org/projects/colander/?badge=latest\n :alt: Documentation Status\n\nAn extensible package which can be used to:\n\n- deserialize and validate a data structure composed of strings,\n mappings, and lists.\n\n- serialize an arbitrary data structure to a data structure composed\n of strings, mappings, and lists.\n\nIt is tested on Python 3.7, 3.8, 3.9, 3.10, and 3.11, and PyPy 3.8.\n\nPlease see https://docs.pylonsproject.org/projects/colander/en/latest/\nfor documentation.\n\nSee https://github.com/Pylons/colander for in-development version.\n\n2.0 (2022-01-02)\n================\n\n- Drop support for Python 2.7, 3.4, 3.5, 3.6.\n\n- Add support for Python 3.10, 3.11.\n\n- **[breaking]** If a ``bytes`` object is serialized by a ``String`` schema\n node with the ``encoding`` parameter specified, it will be passed through\n directly to ``str`` first, causing it to come out with a ``b''`` prefix. In\n order to serialize it properly, it should be decoded to a string first.\n Previously, when the ``encoding`` parameter was specified it would be decoded\n and re-encoded, effectively passing it through untouched, despite not being a\n string type.\n\n- Add a new ``colander.DataURL`` validator.\n See https://github.com/Pylons/colander/pull/348\n\n- Add IDN support to ``colander.url``.\n See https://github.com/Pylons/colander/pull/352\n\n- ``colander.All`` now supports ``colander.Invalid.msg`` being ``None`` or a\n list, otherwise ``colander.Invalid.asdict`` crashes with\n ``TypeError: sequence item 1: expected str instance, NoneType found``.\n See https://github.com/Pylons/colander/pull/333 and\n https://github.com/Pylons/colander/issues/194\n\n- Fixed an issue with ``colander.Mapping`` and ``colander.Sequence``\n where a ``default`` value of ``drop`` caused missing values to be dropped\n during deserialization. (Only ``missing`` values should affect\n deserialization, and only ``default`` values should affect serialization.)\n Added many new test cases for ``MappingSchema`` and ``SequenceSchema``.\n See https://github.com/Pylons/colander/pull/264\n\n- Remove the dependency on ``setuptools`` for resolving pkg_resources-style\n importable paths in ``colander.GlobalObject``.\n\n- Refresh localization files with Babel 2.11.\n\n1.8.3 (2020-11-28)\n==================\n\n- Add support for Python 3.9.\n\n- Fix handling of ``insert_before`` on deferred nodes so that it inserts the\n new node before the specified node instead of always appending to the end of\n ``node.children`` after binding.\n\n1.8.2 (2020-08-07)\n==================\n\n- Fix the broken wheels in 1.8.1 and 1.8.0 to include the locale data. **sigh**\n\n1.8.1 (2020-08-06)\n==================\n\n- Fix the broken wheels in 1.8.0 to include the locale data.\n\n1.8.0 (2020-08-05)\n==================\n\n- Drop support for Python 3.4.\n\n- Add support for Python 3.7 and 3.8.\n\n- Fix deserializer on ``Date`` and ``DateTime`` fields to correctly catch\n ``ValueError`` and ``TypeError`` exception, which can arise when using custom\n formats on the field. Instead of allowing these exceptions to propagate,\n replace then with an ``Invalid`` exception instead.\n See https://github.com/Pylons/colander/pull/338\n\n1.7.0 (2019-02-01)\n==================\n\n- The URL validator regex has been updated to no longer be vulnerable to a\n catastrophic backtracking that would have led to an infinite loop. See\n https://github.com/Pylons/colander/pull/323 and\n https://github.com/Pylons/colander/issues/290. With thanks to Przemek\n (https://github.com/p-m-k).\n\n This does change the behaviour of the URL validator and it no longer supports\n ``file://`` URI scheme (https://tools.ietf.org/html/rfc8089). Users that\n wish to validate ``file://`` URI's should change their validator to use\n ``colander.file_uri`` instead.\n\n It has also dropped support for alternate schemes outside of http/ftp (and\n their secure equivelants). Please let us know if we need to relax this\n requirement.\n\n CVE-ID: CVE-2017-18361\n\n- The Email validator has been updated to use the same regular expression that\n is used by the WhatWG HTML specification, thereby increasing the email\n addresses that will validate correctly from web forms submitted. See\n https://github.com/Pylons/colander/pull/324 and\n https://github.com/Pylons/colander/issues/283\n\n- Number once again will allow you to serialize None to colander.null, this\n reverts an accidental revert. See\n https://github.com/Pylons/colander/issues/204#issuecomment-459556100\n\n- Integer SchemaType now supports an optional ``strict`` mode that will\n validate that the number is an integer, rather than silently accepting floats\n and truncating. See https://github.com/Pylons/colander/pull/322 and\n https://github.com/Pylons/colander/issues/292\n\n1.6.0 (2019-01-31)\n==================\n\n- Support custom format strings on ``DateTime`` and ``Date`` fields.\n See https://github.com/Pylons/colander/pull/318\n\n- Support sub-second precision on ``Time`` fields if provided.\n See https://github.com/Pylons/colander/pull/319\n\n- Format Python code of ``colander`` to conform to the PEP 8 style guide.\n Add some linters (``flake8``, ``black`` and other) into ``tox.ini``.\n See https://github.com/Pylons/colander/pull/320\n\n1.5.1 (2018-09-10)\n==================\n\n- Support deserializing ``colander.drop`` and ``colander.required``.\n See https://github.com/Pylons/colander/pull/304\n\n1.5.0 (2018-09-07)\n==================\n\n- Drop Python 3.3 support. Add PyPy3 and Python 3.7 as allowed failures.\n See https://github.com/Pylons/colander/pull/309\n\n- Fix email validation to not allow all ASCII characters between + and /.\n This prevents email addresses like 'foo1,foo2@bar.baz' from being validated,\n which would be handled as multiple email addresses by subsequent tools.\n See https://github.com/Pylons/colander/pull/315\n\n- Add support for ``enum.Enum`` objects.\n See https://github.com/Pylons/colander/pull/305\n\n- Recompiled language translations and updated ``de`` and ``el`` locales.\n See https://github.com/Pylons/colander/pull/284 and\n https://github.com/Pylons/colander/pull/314\n\n1.4.0 (2017-07-31)\n==================\n\n- Remove the ``colander.iso8601`` backward-compatibility module, broken\n by recent updates to the actual ``iso8601`` package which backed it.\n Downstream libraries can just mechanically adjust imports to use\n ``iso8601.iso8601`` instead of ``colander.iso8601``.\n See https://github.com/Pylons/colander/pull/296\n\n1.3.3 (2017-04-25)\n==================\n\n- Add \"zh_Hant\", traditional chinese translations, and rename simplified\n chinese from \"zh\" to \"zh_Hans\".\n See https://github.com/Pylons/colander/pull/285\n\n- Improve serialization of class objects using ``colander.GlobalObject``.\n See https://github.com/Pylons/colander/pull/288\n\n1.3.2 (2017-01-31)\n==================\n\n- Python 3.6 support.\n\n- Allow deferred schema nodes.\n See https://github.com/Pylons/colander/pull/280\n\n- Fix an issue when using a node multiple times in a schema by cloning it.\n See https://github.com/Pylons/colander/issues/279\n\n- Fix a regression that broke ``SequenceSchema.clone``.\n See https://github.com/Pylons/colander/pull/275\n\n- Update german translations.\n See https://github.com/Pylons/colander/pull/273\n\n- Recompile language files.\n See https://github.com/Pylons/colander/pull/270\n\n1.3.1 (2016-05-23)\n==================\n\n- 1.3 was released without updating the changelog. This release fixes that.\n\n1.3 (2016-05-23)\n================\n\n- Drop Python 2.6 and PyPy3 from the test suite. They are no longer\n supported. See https://github.com/Pylons/colander/pull/263\n\n- ``colander.String`` schema type now supports an optional keyword argument\n ``allow_empty`` which, when True, deserializes an empty string to an\n empty string. When False (default), an empty string deserializes to\n ``colander.null``. This allows for a node to be explicitly required, but\n allow an empty ('') value to be provided.\n https://github.com/Pylons/colander/pull/199\n\n- Add ``separator`` parameter to ``colander.Invalid.asdict``\n (for backward compatibility, default is '; ').\n See https://github.com/Pylons/colander/pull/253\n\n- Fixed an issue with ``SchemaNode.clone`` where it would fail when\n cloning an instance of ``colander.SequenceSchema`` due to initializing\n the schema without any children, violating some checks.\n See https://github.com/Pylons/colander/pull/212\n\n1.2 (2016-01-18)\n================\n\nFeatures\n--------\n\n- Add new exception ``UnsupportedFields``. Used to pass to the caller a list\n of extra fields detected in a cstruct during deserialize.\n See https://github.com/Pylons/colander/pull/241\n\n- Add ``drop`` functionality to ``Sequence`` type.\n See https://github.com/Pylons/colander/pull/225\n\nBug Fixes\n---------\n\n- ``SchemaNode`` will no longer assume the first argument to the constructor\n is the schema type. This allows it to properly fallback to using the\n ``schema_type`` class attribute on subclasses even when using the\n imperative API to pass options to the constructor.\n\n- Fix a bug in which ``MappingSchema``, ``SequenceSchema`` and\n ``TupleSchema`` would always treat the first arg as the schema type. This\n meant that it would fail if passed only nodes to the constructor despite\n the default type being implied by the name. It is now possible to do\n ``MappingSchema(child1, child2, ...)`` instead of\n ``MappingSchema(Mapping(), child1, child2)``.\n\nTranslations\n------------\n\n- Added Finnish translations: ``fi``\n See https://github.com/Pylons/colander/pull/243\n\n1.1 (2016-01-15)\n================\n\nPlatform\n--------\n\n- Add explicit support for Python 3.4, Python 3.5 and PyPy3.\n\nFeatures\n--------\n\n- Add ``min_err`` and ``max_err`` arguments to ``Length``, allowing\n customization of its error messages.\n\n- Add ``colander.Any`` validator: succeeds if at least one of its\n subvalidators succeeded.\n\n- Allow localization of error messages returned by ``colander.Invalid.asdict``\n by adding an optional ``translate`` callable argument.\n\n- Add a ``missing_msg`` argument to ``SchemaNode``, allowing customization\n of the error message used when the node is required and missing.\n\n- Add ``NoneOf`` validator which succeeds if the value is none of the choices.\n\n- Add ``normalize`` option to ``Decimal``, stripping the rightmost\n trailing zeros.\n\nBug Fixes\n---------\n\n- Fix an issue where the ``flatten()`` method produces an invalid name\n (ex: \"answer.0.\") for the type ``Sequence``. See\n https://github.com/Pylons/colander/issues/179\n\n- Fixed issue with ``String`` not being properly encoded when non-string\n values were passed into ``serialize()``\n See `#235 <https://github.com/Pylons/colander/pull/235>`_\n\n- ``title`` was being overwritten when made a child through defining a schema\n as a class. See https://github.com/Pylons/colander/pull/239\n\nTranslations\n------------\n\n- Added new translations: ``el``\n\n- Updated translations: ``fr``, ``de``, ``ja``\n\n1.0 (2014-11-26)\n================\n\nBackwards Incompatibilities\n---------------------------\n\n- ``SchemaNode.deserialize`` will now raise an\n ``UnboundDeferredError`` if the node has an unbound deferred\n validator. Previously, deferred validators were silently ignored.\n See https://github.com/Pylons/colander/issues/47\n\nBug Fixes\n---------\n\n- Removed forked ``iso8601`` and change to dependency on PyPI ``iso8601``\n (due to float rounding bug on microsecond portion when parsing\n iso8601 datetime string). Left an ``iso8601.py`` stub for backwards\n compatibility.\n\n- Time of \"00:00\" no longer gives ``colander.Invalid``.\n\n- Un-break wrapping of callable instances as ``colander.deferred``.\n See https://github.com/Pylons/colander/issues/141.\n\n- Set the max length TLD to 22 in ``Email`` validator based on the\n current list of valid TLDs.\n See https://github.com/Pylons/colander/issues/159\n\n- Fix an issue where ``drop`` was not recognized as a default and was\n returning the ``drop`` instance instead of omitting the value.\n https://github.com/Pylons/colander/issues/139\n\n- Fix an issue where the ``SchemaNode.title`` was clobbered by the ``name``\n when defined as a class attribute.\n See https://github.com/Pylons/colander/pull/183 and\n https://github.com/Pylons/colander/pull/185\n\nTranslations\n------------\n\n- Updated translations: ``fr``, ``de``, ``ja``\n\n\n1.0b1 (2013-09-01)\n==================\n\nBug Fixes\n---------\n\n- In 1.0a1, there was a change merged from\n https://github.com/Pylons/colander/pull/73 which made it possible to supply\n ``None`` as the ``default`` value for a String type, and upon serialization,\n the value would be rendered as ``colander.null`` if the default were used.\n This confused people who were actually supplying the value ``None`` as a\n default when the associated appstruct had no value, so the change has been\n reverted. When you supply ``None`` as the ``default`` argument to a String,\n the rendered serialize() value will again be ``'None'``. Sorry.\n\n- Normalize ``colander.Function`` argument ``message`` to be ``msg``. This now\n matches other APIs within Colander. The ``message`` argument is now\n deprecated and a warning will be emitted.\n https://github.com/Pylons/colander/issues/31\n https://github.com/Pylons/colander/issues/64\n\n- ``iso8601.py``: Convert ``ValueError`` (raised by ``datetime``) into\n ``ParseErrorr`` in ``parse_date``, so that the validation machinery\n upstream handles it properly.\n\n- ``iso8601.py``: Correctly parse datetimes with a timezone of Z even\n when the default_timezone is set. These previously had the default\n timezone.\n\n- ``colander.String`` schema type now raises ``colander.Invalid`` when trying\n to deserialize a non-string item.\n See https://github.com/Pylons/colander/issues/100\n\nFeatures\n--------\n\n- Add ``colander.List`` type, modeled on ``deform.List``: this type\n preserves ordering, and allows duplicates.\n\n- It is now possible to use the value ``colander.drop`` as the ``default``\n value for items that are subitems of a mapping. If ``colander.drop`` is used\n as the ``default`` for a subnode of a mapping schema, and the mapping\n appstruct being serialized does not have a value for that schema node, the\n value will be omitted from the serialized mapping. For instance, the\n following script, when run would not raise an assertion error::\n\n class What(colander.MappingSchema):\n thing = colander.SchemaNode(colander.String(), default=colander.drop)\n\n result = What().serialize({}) # no \"thing\" in mapping\n assert result == {}\n\n- The ``typ`` of a ``SchemaNode`` can optionally be pased in as a keyword\n argument. See https://github.com/Pylons/colander/issues/90\n\n- Allow interpolation of `missing_msg` with properties `title` and `name`\n\n1.0a5 (2013-05-31)\n==================\n\n- Fix bug introduced by supporting spec-mandated truncations of ISO-8601\n timezones. A TypeError would be raised instead of Invalid. See\n https://github.com/Pylons/colander/issues/111.\n\n1.0a4 (2013-05-21)\n==================\n\n- Loosen Email validator regex (permit apostrophes, bang, etc in localpart).\n\n- Allow for timezone info objects to be pickled and unpickled \"more correctly\"\n (Use '__getinitargs__' to provide unpickling-only defaults). See\n https://github.com/Pylons/colander/pull/108.\n\n1.0a3 (2013-05-16)\n==================\n\nFeatures\n--------\n\n- Support spec-mandated truncations of ISO-8601 timezones.\n\n- Support spec-mandated truncations of ISO-8601 datetimes.\n\n- Allow specifying custom representations of values for boolean fields.\n\nBug Fixes\n---------\n\n- Ensure that ``colander.iso8601.FixedOffset`` instances can be unpickled.\n\n- Avoid validating strings as sequences under Py3k.\n\n- Sync documentation with 0.9.9 change to use ``insert_before`` rather than\n ``schema_order``. See https://github.com/Pylons/colander/issues/104\n\n\n1.0a2 (2013-01-30)\n==================\n\nFeatures\n--------\n\n- Add ``colander.ContainsOnly`` and ``colander.url`` validators.\n\n- Add ``colander.instantiate`` to help define schemas containing\n mappings and sequences more succinctly.\n\n1.0a1 (2013-01-10)\n==================\n\nBug Fixes\n---------\n\n- Work around a regression in Python 3.3 for ``colander.Decimal`` when it's\n used with a ``quant`` argument but without a ``rounding`` argument.\n See https://github.com/Pylons/colander/issues/66\n\n- Using ``SchemaNode(String, default='', ..)`` now works properly, or at least\n more intuitively. Previously if an empty-string ``default`` was supplied,\n serialization would return a defaulted value as ``colander.null``. See\n https://github.com/Pylons/colander/pull/73.\n\n- Stricter checking in colander.Mapping to prevent items which are logically\n not mappings from being accepted during validation (see\n https://github.com/Pylons/colander/pull/96).\n\nFeatures\n--------\n\n- Add ``colander.Set`` type, ported from ``deform.Set``\n\n- Add Python 3.3 to tox configuration and use newer tox testing regime\n (setup.py dev).\n\n- Add Python 3.3 Trove classifier.\n\n- Calling ``bind`` on a schema node e.g. ``cloned_node = somenode.bind(a=1,\n b=2)`` on a schema node now results in the cloned node having a\n ``bindings`` attribute of the value ``{'a':1, 'b':2}``.\n\n- It is no longer necessary to pass a ``typ`` argument to a SchemaNode\n constructor if the node class has a ``schema_type`` callable as a class\n attribute which, when called with no arguments, returns a schema type.\n This callable will be called to obtain the schema type if a ``typ`` is not\n supplied to the constructor. The default ``SchemaNode`` object's\n ``schema_type`` callable raises a ``NotImplementedError`` when it is\n called.\n\n- SchemaNode now has a ``raise_invalid`` method which accepts a message and\n raises a colander.Invalid exception using ``self`` as the node and the\n message as its message.\n\n- It is now possible and advisable to subclass ``SchemaNode`` in order to\n create a bundle of default node behavior. The subclass can define the\n following methods and attributes: ``preparer``, ``validator``, ``default``,\n ``missing``, ``name``, ``title``, ``description``, ``widget``, and\n ``after_bind``.\n\n For example, the older, more imperative style that looked like this still\n works, of course::\n\n from colander import SchemaNode\n\n ranged_int = colander.SchemaNode(\n validator=colander.Range(0, 10),\n default = 10,\n title='Ranged Int'\n )\n\n But you can alternately now do something like this::\n\n from colander import SchemaNode\n\n class RangedIntSchemaNode(SchemaNode):\n validator = colander.Range(0, 10)\n default = 10\n title = 'Ranged Int'\n\n ranged_int = RangedInt()\n\n Values that are expected to be callables can now alternately be methods of\n the schemanode subclass instead of plain attributes::\n\n from colander import SchemaNode\n\n class RangedIntSchemaNode(SchemaNode):\n default = 10\n title = 'Ranged Int'\n\n def validator(self, node, cstruct):\n if not 0 < cstruct < 10:\n raise colander.Invalid(node, 'Must be between 0 and 10')\n\n ranged_int = RangedInt()\n\n Note that when implementing a method value such as ``validator`` that\n expects to receive a ``node`` argument, ``node`` must be provided in the\n call signature, even though ``node`` will almost always be the same as\n ``self``. This is because Colander simply treats the method as another\n kind of callable, be it a method, or a function, or an instance that has a\n ``__call__`` method. It doesn't care that it happens to be a method of\n ``self``, and it needs to support callables that are not methods, so it\n sends ``node`` in regardless.\n\n You can't currently use *method* definitions as ``colander.deferred``\n callables. For example this will *not* work::\n\n from colander import SchemaNode\n\n class RangedIntSchemaNode(SchemaNode):\n default = 10\n title = 'Ranged Int'\n\n @colander.deferred\n def validator(self, node, kw):\n request = kw['request']\n def avalidator(node, cstruct):\n if not 0 < cstruct < 10:\n if request.user != 'admin':\n raise colander.Invalid(node, 'Must be between 0 and 10')\n return avalidator\n\n ranged_int = RangedInt()\n bound_ranged_int = ranged_int.bind(request=request)\n\n This will result in::\n\n TypeError: avalidator() takes exactly 3 arguments (2 given)\n\n However, if you treat the thing being decorated as a function instead of a\n method (remove the ``self`` argument from the argument list), it will\n indeed work)::\n\n from colander import SchemaNode\n\n class RangedIntSchemaNode(SchemaNode):\n default = 10\n title = 'Ranged Int'\n\n @colander.deferred\n def validator(node, kw):\n request = kw['request']\n def avalidator(node, cstruct):\n if not 0 < cstruct < 10:\n if request.user != 'admin':\n raise colander.Invalid(node, 'Must be between 0 and 10')\n return avalidator\n\n ranged_int = RangedInt()\n bound_ranged_int = ranged_int.bind(request=request)\n\n In previous releases of Colander, the only way to defer the computation of\n values was via the ``colander.deferred`` decorator. In this release,\n however, you can instead use the ``bindings`` attribute of ``self`` to\n obtain access to the bind parameters within values that are plain old\n methods::\n\n from colander import SchemaNode\n\n class RangedIntSchemaNode(SchemaNode):\n default = 10\n title = 'Ranged Int'\n\n def validator(self, node, cstruct):\n request = self.bindings['request']\n if not 0 < cstruct < 10:\n if request.user != 'admin':\n raise colander.Invalid(node, 'Must be between 0 and 10')\n\n ranged_int = RangedInt()\n bound_range_int = ranged_int.bind(request=request)\n\n If the things you're trying to defer aren't callables like ``validator``,\n but they're instead just plain attributes like ``missing`` or ``default``,\n instead of using a ``colander.deferred``, you can use ``after_bind`` to set\n attributes of the schemanode that rely on binding variables::\n\n from colander import SchemaNode\n\n class UserIdSchemaNode(SchemaNode):\n title = 'User Id'\n\n def after_bind(self, node, kw):\n self.default = kw['request'].user.id\n\n You can override the default values of a schemanode subclass in its\n constructor::\n\n from colander import SchemaNode\n\n class RangedIntSchemaNode(SchemaNode):\n default = 10\n title = 'Ranged Int'\n validator = colander.Range(0, 10)\n\n ranged_int = RangedInt(validator=colander.Range(0, 20))\n\n In the above example, the validation will be done on 0-20, not 0-10.\n\n If a schema node name conflicts with a schema value attribute name on the\n same class, you can work around it by giving the schema node a bogus name\n in the class definition but providing a correct ``name`` argument to the\n schema node constructor::\n\n from colander import SchemaNode, Schema\n\n class SomeSchema(Schema):\n title = 'Some Schema'\n thisnamewillbeignored = colander.SchemaNode(\n colander.String(),\n name='title'\n )\n\n Note that such a workaround is only required if the conflicting names are\n attached to the *exact same* class definition. Colander scrapes off schema\n node definitions at each class' construction time, so it's not an issue for\n inherited values. For example::\n\n from colander import SchemaNode, Schema\n\n class SomeSchema(Schema):\n title = colander.SchemaNode(colander.String())\n\n class AnotherSchema(SomeSchema):\n title = 'Some Schema'\n\n schema = AnotherSchema()\n\n In the above example, even though the ``title = 'Some Schema'`` appears to\n override the superclass' ``title`` SchemaNode, a ``title`` SchemaNode will\n indeed be present in the child list of the ``schema`` instance\n (``schema['title']`` will return the ``title`` SchemaNode) and the schema's\n ``title`` attribute will be ``Some Schema`` (``schema.title`` will return\n ``Some Schema``).\n\n Normal inheritance rules apply to class attributes and methods defined in\n a schemanode subclass. If your schemanode subclass inherits from another\n schemanode class, your schemanode subclass' methods and class attributes\n will override the superclass' methods and class attributes.\n\n Ordering of child schema nodes when inheritance is used works like this:\n the \"deepest\" SchemaNode class in the MRO of the inheritance chain is\n consulted first for nodes, then the next deepest, then the next, and so on.\n So the deepest class' nodes come first in the relative ordering of schema\n nodes, then the next deepest, and so on. For example::\n\n class One(colander.Schema):\n a = colander.SchemaNode(\n colander.String(),\n id='a1',\n )\n b = colander.SchemaNode(\n colander.String(),\n id='b1',\n )\n d = colander.SchemaNode(\n colander.String(),\n id='d1',\n )\n\n class Two(One):\n a = colander.SchemaNode(\n colander.String(),\n id='a2',\n )\n c = colander.SchemaNode(\n colander.String(),\n id='c2',\n )\n e = colander.SchemaNode(\n colander.String(),\n id='e2',\n )\n\n class Three(Two):\n b = colander.SchemaNode(\n colander.String(),\n id='b3',\n )\n d = colander.SchemaNode(\n colander.String(),\n id='d3',\n )\n f = colander.SchemaNode(\n colander.String(),\n id='f3',\n )\n\n three = Three()\n\n The ordering of child nodes computed in the schema node ``three`` will be\n ``['a2', 'b3', 'd3', 'c2', 'e2', 'f3']``. The ordering starts ``a1``,\n ``b1``, ``d1`` because that's the ordering of nodes in ``One``, and\n ``One`` is the deepest SchemaNode in the inheritance hierarchy. Then it\n processes the nodes attached to ``Two``, the next deepest, which causes\n ``a1`` to be replaced by ``a2``, and ``c2`` and ``e2`` to be appended to\n the node list. Then finally it processes the nodes attached to ``Three``,\n which causes ``b1`` to be replaced by ``b3``, and ``d1`` to be replaced by\n ``d3``, then finally ``f`` is appended.\n\n Multiple inheritance works the same way::\n\n class One(colander.Schema):\n a = colander.SchemaNode(\n colander.String(),\n id='a1',\n )\n b = colander.SchemaNode(\n colander.String(),\n id='b1',\n )\n d = colander.SchemaNode(\n colander.String(),\n id='d1',\n )\n\n class Two(colander.Schema):\n a = colander.SchemaNode(\n colander.String(),\n id='a2',\n )\n c = colander.SchemaNode(\n colander.String(),\n id='c2',\n )\n e = colander.SchemaNode(\n colander.String(),\n id='e2',\n )\n\n class Three(Two, One):\n b = colander.SchemaNode(\n colander.String(),\n id='b3',\n )\n d = colander.SchemaNode(\n colander.String(),\n id='d3',\n )\n f = colander.SchemaNode(\n colander.String(),\n id='f3',\n )\n\n three = Three()\n\n The resulting node ordering of ``three`` is the same as the single\n inheritance example: ``['a2', 'b3', 'd3', 'c2', 'e2', 'f3']`` due to the\n MRO deepest-first ordering (``One``, then ``Two``, then ``Three``).\n\nBackwards Incompatibilities\n---------------------------\n\n- Passing non-SchemaNode derivative instances as ``*children`` into a\n SchemaNode constructor is no longer supported. Symptom: ``AttributeError:\n name`` when constructing a SchemaNode.\n\n0.9.9 (2012-09-24)\n==================\n\nFeatures\n--------\n\n- Allow the use of ``missing=None`` for Number. See\n https://github.com/Pylons/colander/pull/59 .\n\n- Create a ``colander.Money`` type that is a Decimal type with\n two-decimal-point precision rounded-up.\n\n- Allow ``quant`` and ``rounding`` args to ``colander.Decimal`` constructor.\n\n- ``luhnok`` validator added (credit card luhn mod10 validator).\n\n- Add an ``insert`` method to SchemaNode objects.\n\n- Add an ``insert_before`` method to SchemaNode objects.\n\n- Better class-based mapping schema inheritance model.\n\n * A node declared in a subclass of a mapping schema superclass now\n overrides any node with the same name inherited from any superclass.\n Previously, it just repeated and didn't override.\n\n * An ``insert_before`` keyword argument may be passed to a SchemaNode\n constructor. This is a string naming a node in a superclass. A node\n with an ``insert_before`` will be placed before the named node in a\n parent mapping schema.\n\n- The ``preparer=`` argument to SchemaNodes may now be a sequence of\n preparers.\n\n- Added a ``cstruct_children`` method to SchemaNode.\n\n- A new ``cstruct_children`` API should exist on schema types. If\n ``SchemaNode.cstruct_children`` is called on a node with a type that does\n not have a ``cstruct_children`` method, a deprecation warning is emitted\n and ``[]`` is returned (this may or may not be the correct value for your\n custom type).\n\nBackwards Incompatibilities\n---------------------------\n\n- The inheritance changes required a minor backwards incompatibility: calling\n ``__setitem__`` on a SchemaNode will no longer raise ``KeyError`` when\n attempting to set a subnode into a node that doesn't already have an\n existing subnode by that name. Instead, the subnode will be appended to\n the child list.\n\nDocumentation\n-------------\n\n- A \"Schema Inheritance\" section was added to the Basics chapter\n documentation.\n\n0.9.8 (2012-04-27)\n==================\n\n- False evaluating values are now serialized to colander.null for\n String, Date, and Time. This resolves the issue where a None value\n would be rendered as 'None' for String, and missing='None' was not\n possible for Date, Datetime, and Time.\n See https://github.com/Pylons/colander/pull/1 .\n\n- Updated Brazilian Portugese translations.\n\n- Updated Japanese translations.\n\n- Updated Russian translations.\n\n- Fix documentation: 0.9.3 allowed explicitly passing None to DateTime\n to have no default timezone applied.\n\n- Add ``dev`` and ``docs`` setup.py aliases (e.g. ``python setup.py dev``).\n\n0.9.7 (2012-03-20)\n==================\n\n- Using ``schema.flatten(...)`` against a mapping schema node without a name\n produced incorrectly dot-prefixed keys. See\n https://github.com/Pylons/colander/issues/37\n\n- Fix invalid.asdict for multiple error messages. See\n https://github.com/Pylons/colander/pull/22 ,\n https://github.com/Pylons/colander/pull/27 ,\n https://github.com/Pylons/colander/pull/12 , and\n https://github.com/Pylons/colander/issues/2 .\n\n- Invalid.messages() now returns an empty list if there are no messages.\n See https://github.com/Pylons/colander/pull/21 .\n\n- ``name`` passed to a SchemaNode constructor was not respected in\n declaratively constructed schemas. Now if you pass ``name`` to the\n SchemaNode constructor within the body of a schema class, it will take\n precedence over the name it's been assigned to in the schema class.\n See https://github.com/Pylons/colander/issues/39 .\n\n- Japanese translation thanks to OCHIAI, Gouji.\n\n- Replaced incorrect ``%{err}`` with correct ``${err}`` in String.deserialize\n error message. See https://github.com/Pylons/colander/pull/41\n\n0.9.6 (2012-02-14)\n==================\n\n- No longer runs on Python 2.4 or 2.5. Python 2.6+ is now required.\n\n- Python 3.2 compatibility.\n\n- Removed a dependency on the iso8601 package (code from the package is now\n inlined in Colander itself).\n\n- Added copyright and licensing information for iso8601-derived code to\n LICENSE.txt.\n\n0.9.5 (2012-01-13)\n==================\n\n- Added Czech translation.\n\n- Compile pt_BR translation (it was previously uncompiled).\n\n- Minor docs fixes.\n\n- Documentation added about flatten and unflatten.\n\n0.9.4 (2011-10-14)\n==================\n\n- ``flatten`` now only includes leaf nodes in the flattened dict.\n\n- ``flatten`` does not include a path element for the name of the type node\n for sequences.\n\n- ``unflatten`` is implemented.\n\n- Added ``__setitem__`` to ``SchemaNode``, allowing replacement of nodes by\n name.\n\n- Added ``get_value`` and ``set_value`` methods to ``Schema`` which allow\n access and mutation of appstructs using dotted name paths.\n\n- Add Swedish, French, Chinese translations.\n\n0.9.3 (2011-06-23)\n==================\n\n- Add ``Time`` type.\n\n- Add Dutch translation.\n\n- Fix documentation: 0.9.2 requires ``deserialize`` of types to explicitly\n deal with the potential to receive ``colander.null``.\n\n- Use ``default_tzinfo`` when deserializing naive datetimes. See\n https://github.com/Pylons/colander/pull/5\n\n- Allow ``default_tzinfo`` to be ``None`` when creating a\n ``colander.DateTime``. See\n https://github.com/Pylons/colander/pull/6\n\n- Add the ability to insert a ``colander.interfaces.Preparer`` between\n deserialization and validation. See the Preparing section in the\n documentation.\n\n0.9.2 (2011-03-28)\n==================\n\n- Added Polish translation, thanks to Jedrzej Nowak.\n\n- Moved to Pylons Project GitHub (https://github.com/Pylons/colander).\n\n- Add tox.ini for testing purposes.\n\n- New API: ``colander.required``. Used as the marker value when a\n ``missing`` argument is left unspecified.\n\n- Bug fix: if a ``title`` argument which is the empty string or ``None`` is\n passed explicitly to a SchemaNode, it is no longer replaced by a title\n computed from the name.\n\n- Add SchemaNode.__contains__ to support \"name in schema\".\n\n- SchemaNode deserialization now unconditionally calls the schema type's\n ``deserialize`` method to obtain an appstruct before attempting to\n validate. Third party schema types should now return ``colander.null`` if\n passed a ``colander.null`` value or another logically \"empty\" value as a\n cstruct during ``deserialize``.\n\n0.9.1 (2010-12-02)\n==================\n\n- When ``colander.null`` was unpickled, the reference created during\n unpickling was *not* a reference to the singleton but rather a new instance\n of the ``colander._null`` class. This was unintentional, because lots of\n code checks for ``if x is colander.null``, which will fail across pickling\n and unpickling. Now the reference created when ``colander.null`` is\n pickled is unpickled as the singleton itself.\n\n0.9 (2010-11-28)\n=================\n\n- SchemaNode constructor now accepts arbitrary keyword arguments. It\n sets any unknown values within the ``**kw`` sequence as attributes\n of the node object.\n\n- Added Spanish locale: thanks to Douglas Cerna for the translations!\n\n- If you use a schema with deferred ``validator``, ``missing`` or\n ``default`` attributes, but you use it to perform serialization and\n deserialization without calling its ``bind`` method:\n\n - If ``validator`` is deferred, no validation will be performed.\n\n - If ``missing`` is deferred, the field will be considered *required*.\n\n - If ``default`` is deferred, the serialization default will be\n assumed to be ``colander.null``.\n\n- Undocumented internal API for all type objects: ``flatten``.\n External type objects should now inherit from\n ``colander.SchemaType`` to get a default implementation.\n\n0.8 (2010/09/08)\n=================\n\n- Docstring fixes to ``colander.SchemaNode`` (``missing`` is not the\n ``null`` value when required, it's a special marker value).\n\n- The concept of \"schema binding\" was added, which allows for a more\n declarative-looking spelling of schemas and schema nodes which have\n dependencies on values available after the schema has already been\n fully constructed. See the new narrative chapter in the\n documentation entitled \"Schema Binding\".\n\n- The interface of ``colander.SchemaNode`` has grown a ``__delitem__``\n method. The ``__iter__``, and ``__getitem__`` methods have now also\n been properly documented.\n\n0.7.3 (2010/09/02)\n==================\n\n- The title of a schema node now defaults to a titleization of the\n ``name``. Underscores in the ``name`` are replaced with empty\n strings and the first letter of every resulting word is capitalized.\n Previously the ``name`` was not split on underscores, and the\n entirety of the ``name`` was capitalized.\n\n- A method of the ``colander.Invalid`` exception named ``messages``\n was added. It returns an iterable of error messages using the\n ``msg`` attribute of its related exception node. If the ``msg``\n attribute is iterable, it is returned. If it is not iterable, a\n single-element list containing the ``msg`` value is returned.\n\n0.7.2 (2010/08/30)\n==================\n\n- Add an ``colander.SchemaNode.__iter__`` method, which iterates over\n the children nodes of a schema node.\n\n- The constructor of a ``colander.SchemaNode`` now accepts a\n ``widget`` keyword argument, for use by Deform (it is not used\n internally).\n\n0.7.1 (2010/06/12)\n==================\n\n- Make it possible to use ``colander.null`` as a ``missing`` argument\n to ``colander.SchemaNode`` for roundtripping purposes.\n\n- Make it possible to pickle ``colander.null``.\n\n0.7.0\n=====\n\nA release centered around normalizing the treatment of default and\nmissing values.\n\nBug Fixes\n---------\n\n- Allow ``colander.Regex`` validator to accept a pattern object\n instead of just a string.\n\n- Get rid of circular reference in Invalid exceptions: Invalid\n exceptions now no longer have a ``parent`` attribute. Instead, they\n have a ``positional`` attribute, which signifies that the parent\n node type of the schema node to which they relate inherits from\n Positional. This attribute isn't an API; it's used only internally\n for reporting.\n\n- Raise a ``TypeError`` when bogus keyword arguments are passed to\n ``colander.SchemaNode``.\n\nBackwards Incompatiblities / New Features\n-----------------------------------------\n\n- ``missing`` constructor arg to SchemaNode: signifies\n *deserialization* default, disambiguated from ``default`` which acted\n as both serialization and deserialization default previously.\n\n Changes necessitated / made possible by SchemaNode ``missing``\n addition:\n\n - The ``allow_empty`` argument of the ``colander.String`` type was\n removed (use ``missing=''`` as a wrapper SchemaNode argument\n instead).\n\n- New concept: ``colander.null`` input to serialization and\n deserialization. Use of ``colander.null`` normalizes serialization\n and deserialization default handling.\n\n Changes necessitated / made possible by ``colander.null`` addition:\n\n - ``partial`` argument and attribute of colander.MappingSchema has\n been removed; all serializations are partial, and partial\n deserializations are not necessary.\n\n - ``colander.null`` values are added to the cstruct for partial\n serializations instead of omitting missing node values from\n the cstruct.\n\n - ``colander.null`` may now be present in serialized and\n deserialized data structures.\n\n - ``sdefault`` attribute of SchemaNode has been removed; we never need\n to serialize a default anymore.\n\n - The value ``colander.null`` will be passed as ``appstruct`` to\n each type's ``serialize`` method when a mapping appstruct doesn't\n have a corresponding key instead of ``None``, as was the practice\n previously.\n\n - The value ``colander.null`` will be passed as ``cstruct`` to\n each type's ``deserialize`` method when a mapping cstruct\n doesn't have a corresponding key instead of ``None``, as was the\n practice previously.\n\n - Types now must handle ``colander.null`` explicitly during\n serialization.\n\n- Updated and expanded documentation, particularly with respect to new\n ``colander.null`` handling.\n\n- The ``value`` argument to the ``serialize`` method of a SchemaNode\n is now named ``appstruct``. It is no longer a required argument; it\n defaults to ``colander.null`` now.\n\n The ``value`` argument to the ``deserialize`` method of a SchemaNode\n is now named ``cstruct``. It is no longer a required argument; it\n defaults to ``colander.null`` now.\n\n- The ``value`` argument to the ``serialize`` method of each built-in\n type is now named ``appstruct``, and is now required: it is no\n longer a keyword argument that has a default.\n\n The ``value`` argument to the ``deserialize`` method of each\n built-in type is now named ``cstruct``, and is now required: it is\n no longer a keyword argument that has a default.\n\n0.6.2 (2010-05-08)\n==================\n\n- The default ``encoding`` parameter value to the ``colander.String``\n type is still ``None``, however its meaning has changed. An\n encoding of ``None`` now means that no special encoding and decoding\n of Unicode values is done by the String type. This differs from the\n previous behavior, where ``None`` implied that the encoding was\n ``utf-8``. Pass the encoding as ``utf-8`` specifically to get the\n older behavior back. This is in support of Deform.\n\n- The default ``err_template`` value attached to the ``colander.Date``\n and ``colander.Datetime`` types was changed. It is now simply\n ``Invalid date`` instead of ``_('${val} cannot be parsed as an\n iso8601 date: ${err}')``. This is in support of Deform.\n\n- Fix bug in ``colander.Boolean`` that attempted to call ``.lower`` on\n a bool value when a default value was found for the schema node.\n\n0.6.1 (2010-05-04)\n==================\n\n- Add a Decimal type (number type which uses ``decimal.Decimal`` as a\n deserialization target).\n\n0.6.0 (2010-05-02)\n==================\n\n- (Hopefully) fix intermittent datetime-granularity-related test\n failures.\n\n- Internationalized error messages. This required some changes to\n error message formatting, which may impact you if you were feeding\n colander an error message template.\n\n- New project dependency: ``translationstring`` package for\n internationalization.\n\n- New argument to ``colander.String`` constructor: ``allow_empty``.\n This is a boolean representing whether an empty string is a valid\n value during deserialization, defaulting to ``False``.\n\n- Add minimal documentation about the composition of a\n colander.Invalid exception to the narrative docs.\n\n- Add (existing, but previously non-API) colander.Invalid attributes\n to its interface within the API documentation.\n\n0.5.2 (2010-04-09)\n==================\n\n- Add Email and Regex validators (courtesy Steve Howe).\n\n- Raise a ``colander.Invalid`` error if a ``colander.SequenceSchema``\n is created with more than one member.\n\n- Add ``Function`` validator.\n\n- Fix bug in serialization of non-Unicode values in the ``String`` class.\n\n- Get rid of ``pserialize`` in favor of making ``serialize`` always\n partially serialize.\n\n- Get rid of ``pdeserialize``: it existed only for symmetry. We'll\n add something like it back later if we need it.\n\n0.5.1 (2010-04-02)\n==================\n\n- The constructor arguments to a the ``colander.Schema`` class are now\n sent to the constructed SchemaNode rather than to the type it represents.\n\n- Allow ``colander.Date`` and ``colander.DateTime`` invalid error\n messages to be customized.\n\n- Add a ``pos`` argument to the ``colander.Invalid.add`` method.\n\n- Add a ``__setitem__`` method to the ``colander.Invalid`` class.\n\n- The ``colander.Mapping`` constructor keyword argument\n ``unknown_keys`` has been renamed to ``unknown``.\n\n- Allow ``colander.Mapping`` type to accept a new constructor\n argument: ``partial``.\n\n- New interface methods required by types and schema nodes:\n ``pserialize`` and ``pdeserialize``. These partially serialize or\n partially deserialize a value (the definition of \"partial\" is up to\n the type).\n\n0.5 (2010-03-31)\n================\n\n- 0.4 was mispackaged (CHANGES.txt missing); no code changes from 0.4\n however.\n\n0.4 (2010-03-30)\n================\n\n- Add ``colander.DateTime`` and ``colander.Date`` data types.\n\n- Depend on the ``iso8601`` package for date support.\n\n0.3 (2010-03-29)\n================\n\n- Subnodes of a schema node are now kept in the ``children`` attribute\n rather than the ``nodes`` attribute.\n\n- Add an ``sdefault`` property to ``colander.SchemaNode`` objects.\n\n- Add a ``clone`` method to ``colander.SchemaNode`` objects.\n\n- Add a ``__str__`` method to the ``colander.Invalid`` exception that\n prints an error summary.\n\n- Various error message improvements.\n\n- Add ``colander.Length`` validator class.\n\n0.2 (2010-03-23)\n================\n\n- Make nodetype overrideable.\n\n- Add __getitem__ to SchemaNode.\n\n- Fix OneOf message.\n\n- Capitalize node titles.\n\n- Deal with empty strings in String, Boolean, and Float types.\n\n- Introduce description; make title the same as name.\n\n- Remove copy method from schemanode.\n\n- Allow schema nodes to have titles.\n\n- The term \"structure\" is too overloaded to use for schema purposes:\n structure -> schema node.\n\n- Make Sequence more like Tuple and Mapping (it uses a substructure\n rather than a structure parameter to denote its type).\n\n- Add __repr__ and copy methods to structure.\n\n- Add accept_scalar flag to Sequence.\n\n\n0.1 (2010-03-14)\n================\n\n- Initial release.\n",
"bugtrack_url": null,
"license": "BSD-derived (http://www.repoze.org/LICENSE.txt)",
"summary": "A simple schema-based serialization and deserialization library",
"version": "2.0",
"split_keywords": [
"serialize",
"deserialize",
"validate",
"schema",
"validation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8e55b83c3cf4e997ab2c1e1f1bccee2fb1b75ad6977faa0c906f965da55be1bf",
"md5": "8b8c3a4838965cb234927079142e4a99",
"sha256": "cb6b929fd0e79cdd3d310d3229e8f7884bd4fddd5cbf1d882063a6fb283b272b"
},
"downloads": -1,
"filename": "colander-2.0-py3-none-any.whl",
"has_sig": true,
"md5_digest": "8b8c3a4838965cb234927079142e4a99",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 98754,
"upload_time": "2023-01-03T02:20:02",
"upload_time_iso_8601": "2023-01-03T02:20:02.150536Z",
"url": "https://files.pythonhosted.org/packages/8e/55/b83c3cf4e997ab2c1e1f1bccee2fb1b75ad6977faa0c906f965da55be1bf/colander-2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1cdecf5f43f6ad702486473a40480d4f36efc03cba29ca372b55d78e9af0f2ca",
"md5": "24ddacac85dcd7d702085ecb7a788965",
"sha256": "419cd68178d2ee6ee4cae5d5cb1830725634b0a2840917156e89eb2592237ef3"
},
"downloads": -1,
"filename": "colander-2.0.tar.gz",
"has_sig": true,
"md5_digest": "24ddacac85dcd7d702085ecb7a788965",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 137014,
"upload_time": "2023-01-03T02:20:04",
"upload_time_iso_8601": "2023-01-03T02:20:04.696957Z",
"url": "https://files.pythonhosted.org/packages/1c/de/cf5f43f6ad702486473a40480d4f36efc03cba29ca372b55d78e9af0f2ca/colander-2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-03 02:20:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "Pylons",
"github_project": "colander",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "colander"
}