Zope.schema

Latest version: v7.0.1

Safety actively analyzes 628499 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 4 of 10

4.6.1

==================

- Fix the ``Field`` constructor to again allow ``MessageID`` values
for the ``description``. This was a regression introduced with the
fix for `issue 60
<https://github.com/zopefoundation/zope.schema/issues/60>`_. See
`issue 63
<https://github.com/zopefoundation/zope.schema/issues/63>`_.

4.6.0

==================

- Add support for Python 3.7.

- ``Object`` instances call their schema's ``validateInvariants``
method by default to collect errors from functions decorated with
``invariant`` when validating. This can be disabled by passing
``validate_invariants=False`` to the ``Object`` constructor. See
`issue 10 <https://github.com/zopefoundation/zope.schema/issues/10>`_.

- ``ValidationError`` can be sorted on Python 3.

- ``DottedName`` and ``Id`` consistently handle non-ASCII unicode
values on Python 2 and 3 by raising ``InvalidDottedName`` and
``InvalidId`` in ``fromUnicode`` respectively. Previously, a
``UnicodeEncodeError`` would be raised on Python 2 while Python 3
would raise the descriptive exception.

- ``Field`` instances are hashable on Python 3, and use a defined
hashing algorithm that matches what equality does on all versions of
Python. Previously, on Python 2, fields were hashed based on their
identity. This violated the rule that equal objects should have
equal hashes, and now they do. Since having equal hashes does not
imply that the objects are equal, this is not expected to be a
compatibility problem. See `issue 36
<https://github.com/zopefoundation/zope.schema/issues/36>`_.

- ``Field`` instances are only equal when their ``.interface`` is
equal. In practice, this means that two otherwise identical fields
of separate schemas are not equal, do not hash the same, and can
both be members of the same ``dict`` or ``set``. Prior to this
release, when hashing was identity based but only worked on Python
2, that was the typical behaviour. (Field objects that are *not*
members of a schema continue to compare and hash equal if they have
the same attributes and interfaces.) See `issue 40
<https://github.com/zopefoundation/zope.schema/issues/40>`_.

- Orderable fields, including ``Int``, ``Float``, ``Decimal``,
``Timedelta``, ``Date`` and ``Time``, can now have a
``missing_value`` without needing to specify concrete ``min`` and
``max`` values (they must still specify a ``default`` value). See
`issue 9 <https://github.com/zopefoundation/zope.schema/issues/9>`_.

- ``Choice``, ``SimpleVocabulary`` and ``SimpleTerm`` all gracefully
handle using Unicode token values with non-ASCII characters by encoding
them with the ``backslashreplace`` error handler. See `issue 15
<https://github.com/zopefoundation/zope.schema/issues/15>`_ and `PR
6 <https://github.com/zopefoundation/zope.schema/pull/6>`_.

- All instances of ``ValidationError`` have a ``field`` and ``value``
attribute that is set to the field that raised the exception and the
value that failed validation.

- ``Float``, ``Int`` and ``Decimal`` fields raise ``ValidationError``
subclasses for literals that cannot be parsed. These subclasses also
subclass ``ValueError`` for backwards compatibility.

- Add a new exception ``SchemaNotCorrectlyImplemented``, a subclass of
``WrongContainedType`` that is raised by the ``Object`` field. It
has a dictionary (``schema_errors``) mapping invalid schema
attributes to their corresponding exception, and a list
(``invariant_errors``) containing the exceptions raised by
validating invariants. See `issue 16
<https://github.com/zopefoundation/zope.schema/issues/16>`_.

- Add new fields ``Mapping`` and ``MutableMapping``, corresponding to
the collections ABCs of the same name; ``Dict`` now extends and
specializes ``MutableMapping`` to only accept instances of ``dict``.

- Add new fields ``Sequence`` and ``MutableSequence``, corresponding
to the collections ABCs of the same name; ``Tuple`` now extends
``Sequence`` and ``List`` now extends ``MutableSequence``.

- Add new field ``Collection``, implementing ``ICollection``. This is
the base class of ``Sequence``. Previously this was known as
``AbstractCollection`` and was not public. It can be subclassed to
add ``value_type``, ``_type`` and ``unique`` attributes at the class
level, enabling a simpler constructor call. See `issue 23
<https://github.com/zopefoundation/zope.schema/issues/23>`_.

- Make ``Object`` respect a ``schema`` attribute defined by a
subclass, enabling a simpler constructor call. See `issue 23
<https://github.com/zopefoundation/zope.schema/issues/23>`_.

- Add fields and interfaces representing Python's numeric tower. In
descending order of generality these are ``Number``, ``Complex``,
``Real``, ``Rational`` and ``Integral``. The ``Int`` class extends
``Integral``, the ``Float`` class extends ``Real``, and the
``Decimal`` class extends ``Number``. See `issue 49
<https://github.com/zopefoundation/zope.schema/issues/49>`_.

- Make ``Iterable`` and ``Container`` properly implement ``IIterable``
and ``IContainer``, respectively.

- Make ``SimpleVocabulary.fromItems`` accept triples to allow
specifying the title of terms. See `issue 18
<https://github.com/zopefoundation/zope.schema/issues/18>`_.

- Make ``TreeVocabulary.fromDict`` only create
``ITitledTokenizedTerms`` when a title is actually provided.

- Make ``Choice`` fields reliably raise a ``ValidationError`` when a
named vocabulary cannot be found; for backwards compatibility this
is also a ``ValueError``. Previously this only worked when the
default ``VocabularyRegistry`` was in use, not when it was replaced
with `zope.vocabularyregistry
<https://pypi.org/project/zope.vocabularyregistry/>`_. See `issue 55
<https://github.com/zopefoundation/zope.schema/issues/55>`_.

- Make ``SimpleVocabulary`` and ``SimpleTerm`` have value-based
equality and hashing methods.

- All fields of the schema of an ``Object`` field are bound to the
top-level value being validated before attempting validation of
their particular attribute. Previously only ``IChoice`` fields were
bound. See `issue 17
<https://github.com/zopefoundation/zope.schema/issues/17>`_.

- Share the internal logic of ``Object`` field validation and
``zope.schema.getValidationErrors``. See `issue 57
<https://github.com/zopefoundation/zope.schema/issues/57>`_.


- Make ``Field.getDoc()`` return more information about the properties
of the field, such as its required and readonly status. Subclasses
can add more information using the new method
``Field.getExtraDocLines()``. This is used to generate Sphinx
documentation when using `repoze.sphinx.autointerface
<https://pypi.org/project/repoze.sphinx.autointerface/>`_. See
`issue 60
<https://github.com/zopefoundation/zope.schema/issues/60>`_.

4.5.0

==================

- Drop support for Python 2.6, 3.2, and 3.3.

- Add support for Python 3.5 and 3.6.

- Drop support for 'setup.py test'. Use zope.testrunner instead.

4.4.2

==================

- Fix description of min max field: max value is included, not excluded.

4.4.1

==================

- Add support for Python 3.4.

4.4.0

==================

- Add an event on field properties to notify that a field has been updated.
This event enables definition of subscribers based on an event, a context
and a field. The event contains also the old value and the new value.
(also see package ``zope.schemaevent`` that define a field event handler)

Page 4 of 10

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.