- Nothing changed yet.
- Make
nti.schema.field.FieldConverter
a public utility class.
- Drop support for anything less than Python 3.10.
- Add support for all current versions of Python, up to 3.13.
- Use native namespace packages.
Add support for Python 3.9.
Drop support for Python 3.5.
Fix deprecation warnings emitted by using this package, and make the deprecation warnings it emits more precise. See issue 58.
Fix constructing a
Variant
to do some extra validation ofIMapping
fields to require that both thekey_type
andvalue_type
are given. Previously, if one or both were leftNone
, anAttributeError
would be raised when the field was asked to validate data or itsfromObject()
method was called. Now, aRequiredMissing
error will be raised when theVariant
is created. Some other nested uses ofDict
fields, such as aSequence
, could also have raised theAttributeError
; this may change in the future to raise at construction time as well.See issue 59.
- Fix plurality of error message for fields with min length of 1.
Improve the speed of
SchemaConfigured
subclasses. See issue 54.This involves some caching, so be sure to read the documentation for
nti.schema.schema
if you ever mutate classes directly, or mutate the results ofschemadict
.
- Require zope.interface 5.0.0 and related dependencies.
- Ensure all objects have consistent interface resolution orders.
- Add support for Python 3.8.
StrippedValidTextLine
should accept single character lines.
- Ensure
StrippedValidTextLine
correctly recognizes single character values as stripped. Previously, 'b' would have been rejected.
- JSON schemas report the schema for
IObject
fields and the schemas for the possible fields inIVariant
. - Fields in JSON schemas may specify a JSON-serializable dictionary
to be passed as the
application_info
schema value. See issue 44. - JSON schemas now output more constraints automatically. See issue 47.
- JSON schemas now include nested
value_type
andkey_type
for collection and mapping fields. See issue 42. - JSON schemas now include (translated)
title
anddescription
values for fields. See issue 41.
- Add
nti.schema.fieldproperty.field_name
to compensate for the mangling thatFieldPropertyStoredThroughField
does.
- Fix
Variant
and other implementations ofIFromObject
to stop passing known non-text values tofromUnicode
methods. This only worked with certain fields (such aszope.schema.Number
) that could accept non-text values, usually by implementation accident, and could have surprising consequences. Instead, non-text values will be passed to thevalidate
method. - Fix
Variant
to stop double-validating values. The underlyingfromUnicode
,fromBytes
orfromObject
methods were supposed to already validate.
- Make
VariantValidationError
andVariant
have more useful string representations. - Make
fromObject
methods more gracefully handle an AttributeError raised by an underlyingfromUnicode
method on non-string input (such as None). This is especially helpful forVariant
fields because they can catch the error and continue to the next field. - Fix
Variant
,TupleFromObject
,DictFromObject
,ListFromObject
andListOrTupleFromObject
to allow themissing_value
(which defaults toNone
) in theirfromObject
methods; passing that value in simply returns it without raising an exception if the field is not required. If the field is required, aRequiredMissing
is raised. Previously the sequences raised aWrongType
error, whileVariant
may or may not have raised an error, depending on the underlying fields in use.
Variant
objects now automatically addfromObject
support toICollection
andIMapping
fields that do not already provide it, if theirvalue_type
(andkey_type
) qualify by being either anObject
field, or something that providesIFromObject
or can be made to, such as a collection or mapping.
- Add
VariantValidationError
, an error raised by variant fields when none of their constituent fields could adapt or validate the value.
- Add support for
IFromBytes
in zope.schema 4.8.0. - The
Variant
andListOrTupleFromObject
,TupleFromObject
,DictFromObject
fields all have tweaked behaviour infromObject
. If the incoming value is a bytestring or text string, the underlying field'sfromBytes
andfromUnicode
will be called in preference to afromObject
, if that method is implemented. ValidSet
andUniqueIterable
now implementfromObject
.- All fields that implement
fromObject
now accept anObject
field for theirvalue_type
(andkey_type
in the case ofDictFromObject
) and will attempt to adapt objects that do not provide the schema infromObject
.
- Adjust the deprecated
zope.schema.interfaces.InvalidValue
to be a simple alias forzope.schema.interfaces.InvalidValue
(while preserving the constructor) for improved backwards compatibility.
- Add support for zope.schema 4.7.0; drop support for older versions.
- Fix the
repr
ofnti.schema.interfaces.InvalidValue
. See issue 26. nti.schema.jsonschema
turns more abstract field types into concrete types. See issue 29.
- Make
nti.schema.interfaces.InvalidValue
a class again. It is deprecated. See issue 24.
- Drop support for
dm.zope.schema
fields, in particular theObject
field. The validation performed byzope.schema.Object
is much improved. - Drop support for
zope.schema
older than 4.6.1. - Deprecate
nti.schema.field.Number
. - Add support for Python 3.7.
- Minor fix for changes in zope.schema 4.6.0 (import
BeforeObjectAssignedEvent
from its new, but still private, location).
- Depend on zope.deferredimport >= 4.2.1 to be able to generate Sphinx documentation.
- Clean up code to match PEP8.
- Fix an
UnboundLocalError
on Python 3 in theVariant
field. See issue 14.
- Drop the Python 2 dependency on
plone.i18n
in favor of the new librarynti.i18n
, which supports Python 3. Ifplone.i18n
is installed, it should not be configured (ZCML), but its utility objects can be looked up by either interface.
- Remove use of
unicode_literals
. - Add support for Python 3.6.
- The
SchemaConfigured
constructor doesn't hide errors when checking for properties on Python 2. See issue 11.
- Add info to minLength validation message.
- Add
Acquisition
andzope.event
as install dependencies. Previously they were only pulled in via thetest
extra.
- Substantial speedups to the hash functions generated by
EqHash
. - Substantial speedups to the equality functions generated by
EqHash
.
- Add support for Python 3. Note the countries vocabulary will not be complete on Python 3.
- Drop the
dolmen.builtins
dependency. - Drop the
dm.zope.schema
dependency. - The
plone.i18n
dependency is Python 2 only (and can even be removed). - The matchers in
nti.schema.testing
have been moved tonti.testing.matchers
. - Using
AdaptingFieldProperty
will now raise the more specificSchemaNotProvided
error instead of aTypeError
if adapting the value fails. EqHash
has moved fromnti.schema.schema
tonti.schema.eqhash
. A compatibility shim remains.