- Add support for Python 3.12.
- Drop support for Python 3.7.
- Fix fallback when
zope.i18nmessageid
is not installed (regression introduced in 7.0.0).
- Add support for Python 3.11.
- Drop support for Python 2.7, 3.5, 3.6.
- Drop
zope.schema._compat
module. - Fix test deprecation warning on Python 3.11. (#112)
- Fix outsized integer test values that break tests on newer Python versions. (#115)
- Add support for Python 3.10.
- Fix incompatibility introduced in 6.1.0: The Bool field constructor implicitly set required to False if not given. While this is the desired behavior in most common cases, it broke special cases. See issue 104 (scroll down, it is around the reopen).
- Fix
IField.required
to not be required by default. See issue 104.
- Bring branch coverage to 100%.
- Add support for Python 3.9.
- Fix FieldUpdateEvent implementation by having an
object
attribute as theIFieldUpdatedEvent
interfaces claims there should be.
- Require zope.interface 5.0.
- Ensure the resolution orders of all fields are consistent and make
sense. In particular,
Bool
fields now correctly implementIBool
beforeIFromUnicode
. See issue 80. - Add support for Python 3.8.
- Drop support for Python 3.4.
- Fix: add
Text.unicode_normalization = 'NFC'
as default, because some are persisting schema fields. Setting that attribute only in__init__
breaks loading old objects.
- Set
IDecimal
attributesmin
,max
anddefault
asDecimal
type instead ofNumber
. See issue 88. - Enable unicode normalization for
Text
fields. The default is NFC normalization. Valid forms are 'NFC', 'NFKC', 'NFD', and 'NFKD'. To disable normalization, setunicode_normalization
toFalse
orNone
when calling__init__
of theText
field. See issue 86.
- Fix a ReST error in getDoc() results when having "subfields" with titles.
- Make sure that the title for
IObject.validate_invariants
is a unicode string.
- Fix
SimpleTerm
token for non-ASCII bytes values.
- Make
NativeString
andNativeStringLine
distinct types that implement the newly-distinct interfacesINativeString
andINativeStringLine
. Previously these were just aliases for eitherText
(on Python 3) orBytes
(on Python 2). - Fix
Field.getDoc()
whenvalue_type
orkey_type
is present. Previously it could produce ReST that generated Sphinx warnings. See issue 76. - Make
DottedName
accept leading underscores for each segment. - Add
PythonIdentifier
, which accepts one segment of a dotted name, e.g., a python variable or class.
- Add the interface
IFromBytes
, which is implemented by the numeric and bytes fields, as well asURI
,DottedName
, andId
. - Fix passing
None
as the description to a field constructor. See issue 69.
- Make
WrongType
have anexpected_type
field. - Add
NotAnInterface
, an exception derived fromWrongType
andSchemaNotProvided
and raised by the constructor ofObject
and when validation fails forInterfaceField
. - Give
SchemaNotProvided
aschema
field. - Give
WrongContainedType
anerrors
list. - Give
TooShort
,TooLong
,TooBig
andTooSmall
abound
field and the common superclassesLenOutOfBounds
,OrderableOutOfBounds
, respectively, both of which inherit fromOutOfBounds
.
- Fix checking a field's constraint to set the
field
andvalue
properties if the constraint raises aValidationError
. See issue 66.
- Fix the
Field
constructor to again allowMessageID
values for thedescription
. This was a regression introduced with the fix for issue 60. See issue 63.
- Add support for Python 3.7.
Object
instances call their schema'svalidateInvariants
method by default to collect errors from functions decorated with@invariant
when validating. This can be disabled by passingvalidate_invariants=False
to theObject
constructor. See issue 10.ValidationError
can be sorted on Python 3.DottedName
andId
consistently handle non-ASCII unicode values on Python 2 and 3 by raisingInvalidDottedName
andInvalidId
infromUnicode
respectively. Previously, aUnicodeEncodeError
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.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 samedict
orset
. 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.- Orderable fields, including
Int
,Float
,Decimal
,Timedelta
,Date
andTime
, can now have amissing_value
without needing to specify concretemin
andmax
values (they must still specify adefault
value). See issue 9. Choice
,SimpleVocabulary
andSimpleTerm
all gracefully handle using Unicode token values with non-ASCII characters by encoding them with thebackslashreplace
error handler. See issue 15 and PR 6.- All instances of
ValidationError
have afield
andvalue
attribute that is set to the field that raised the exception and the value that failed validation. Float
,Int
andDecimal
fields raiseValidationError
subclasses for literals that cannot be parsed. These subclasses also subclassValueError
for backwards compatibility.- Add a new exception
SchemaNotCorrectlyImplemented
, a subclass ofWrongContainedType
that is raised by theObject
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. - Add new fields
Mapping
andMutableMapping
, corresponding to the collections ABCs of the same name;Dict
now extends and specializesMutableMapping
to only accept instances ofdict
. - Add new fields
Sequence
andMutableSequence
, corresponding to the collections ABCs of the same name;Tuple
now extendsSequence
andList
now extendsMutableSequence
. - Add new field
Collection
, implementingICollection
. This is the base class ofSequence
. Previously this was known asAbstractCollection
and was not public. It can be subclassed to addvalue_type
,_type
andunique
attributes at the class level, enabling a simpler constructor call. See issue 23. - Make
Object
respect aschema
attribute defined by a subclass, enabling a simpler constructor call. See issue 23. - Add fields and interfaces representing Python's numeric tower. In
descending order of generality these are
Number
,Complex
,Real
,Rational
andIntegral
. TheInt
class extendsIntegral
, theFloat
class extendsReal
, and theDecimal
class extendsNumber
. See issue 49. - Make
Iterable
andContainer
properly implementIIterable
andIContainer
, respectively. - Make
SimpleVocabulary.fromItems
accept triples to allow specifying the title of terms. See issue 18. - Make
TreeVocabulary.fromDict
only createITitledTokenizedTerms
when a title is actually provided. - Make
Choice
fields reliably raise aValidationError
when a named vocabulary cannot be found; for backwards compatibility this is also aValueError
. Previously this only worked when the defaultVocabularyRegistry
was in use, not when it was replaced with zope.vocabularyregistry. See issue 55. - Make
SimpleVocabulary
andSimpleTerm
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 onlyIChoice
fields were bound. See issue 17. - Share the internal logic of
Object
field validation andzope.schema.getValidationErrors
. See issue 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 methodField.getExtraDocLines()
. This is used to generate Sphinx documentation when using repoze.sphinx.autointerface. See issue 60.
- 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.
- Fix description of min max field: max value is included, not excluded.
- Add support for Python 3.4.
- 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)
- PEP 8 cleanup.
- Don't raise RequiredMissing if a field's defaultFactory returns the field's missing_value.
- Update
boostrap.py
to version 2.2. - Add the ability to swallow ValueErrors when rendering a SimpleVocabulary, allowing for cases where vocabulary items may be duplicated (e.g., due to user input).
- Include the field name in
ConstraintNotSatisfied
.
- Fix Python 2.6 support. (Forgot to run tox with all environments before last release.)
- Make sure that we do not fail during bytes decoding of term token when generated from a bytes value by ignoring all errors. (Another option would have been to hexlify the value, but that would break way too many tests.)
- Fix a bug where bytes values were turned into tokens inproperly in Python 3.
- Add
zope.schema.fieldproperty.createFieldProperties()
function which maps schema fields intoFieldProperty
instances.
- Add support for Python 3.3.
- Fix the default property of fields that have no defaultFactory attribute.
- Automate build of Sphinx HTML docs and running doctest snippets via tox.
- Drop explicit support for Python 3.1.
- Introduce NativeString and NativeStringLine which are equal to Bytes and BytesLine on Python 2 and Text and TextLine on Python 3.
- Change IURI from a Bytes string to a "native" string. This is a backwards incompatibility which only affects Python 3.
- Bring unit test coverage to 100%.
- Move doctests from the package and wired up as normal Sphinx documentation.
- Add explicit support for PyPy.
- Add support for continuous integration using
tox
andjenkins
. - Drop the external
six
dependency in favor of a much-trimmedzope.schema._compat
module. - Ensure tests pass when run under
nose
. - Add
setup.py dev
alias (runssetup.py develop
plus installsnose
andcoverage
). - Add
setup.py docs
alias (installsSphinx
and dependencies).
- Remove trailing slash in MANIFEST.in, it causes Winbot to crash.
- Add TreeVocabulary for nested tree-like vocabularies.
- Fix broken Object field validation where the schema contains a Choice with ICountextSourceBinder source. In this case the vocabulary was not iterable because the field was not bound and the source binder didn't return the real vocabulary. Added simple test for IContextSourceBinder validation. But a test with an Object field with a schema using a Choice with IContextSourceBinder is still missing.
- Fix bug in
fromUnicode
method ofDottedName
which would fail validation on being given unicode. Introduced in 4.0.0.
- Fix deprecated unittest methods.
- Port to Python 3. This adds a dependency on six and removes support for Python 2.5.
- Fix broken Object field validation. Previous version was using a volatile property on object field values which ends in a ForbiddenAttribute error on security proxied objects.
Implement a
defaultFactory
attribute for all fields. It is a callable that can be used to compute default values. The simplest case is:Date(defaultFactory=datetime.date.today)
If the factory needs a context to compute a sensible default value, then it must provide
IContextAwareDefaultFactory
, which can be used as follows:@provider(IContextAwareDefaultFactory) def today(context): return context.today() Date(defaultFactory=today)
- Rename the validation token, used in the validation of schema with Object
Field to avoid infinite recursion:
__schema_being_validated
became_v_schema_being_validated
, a volatile attribute, to avoid persistency and therefore, read/write conflicts. - Don't allow "[]^`" in DottedName. https://bugs.launchpad.net/zope.schema/+bug/191236
- Improve error messages when term tokens or values are duplicates.
- Fix the buildout so the tests run.
- fix validation of schema with Object Field that specify Interface schema.
- Prefer the standard libraries doctest module to the one from zope.testing.
- Avoid maximum recursion when validating Object field that points to cycles
- Make the dependency on
zope.i18nmessageid
optional.
- Allow "setup.py test" to run at least a subset of the tests runnable
via
bin/test
(227 forsetup.py test
vs. 258. forbin/test
) - Make
zope.schema._bootstrapfields.ValidatedProperty
descriptor work under Jython. - Make "setup.py test" tests pass on Jython.
- Prefer zope.testing.doctest over doctestunit.
- Extend validation error to hold the field name.
- Add FieldProperty class that uses Field.get and Field.set methods instead of storing directly on the instance __dict__.
- Don't fail trying to validate default value for Choice fields with IContextSourceBinder object given as a source. See https://bugs.launchpad.net/zope3/+bug/340416.
- Add an interface for
DottedName
field. - Add
vocabularyName
attribute to theIChoice
interface, change "vocabulary" attribute description to be more sensible, making itzope.schema.Field
instead of plainzope.interface.Attribute
. - Make IBool interface of Bool more important than IFromUnicode so adapters registered for IBool take precendence over adapters registered for IFromUnicode.
- Make Choice and Bool fields implement IFromUnicode interface, because
they do provide the
fromUnicode
method. - Change package's mailing list address to zope-dev at zope.org, as zope3-dev at zope.org is now retired.
- Fix package's documentation formatting. Change package's description.
- Add buildout part that builds Sphinx-generated documentation.
- Remove zpkg-related file.
- Made validation tests compatible with Python 2.5 again (hopefully not breaking Python 2.4)
- Add an __all__ package attribute to expose documentation.
- Stop using the old old set type.
- Make tests compatible and silent with Python 2.4.
- Fix __cmp__ method in ValidationError. Show some side effects based on the existing __cmp__ implementation. See validation.txt
- Make 'repr' of the ValidationError and its subclasses more sensible. This may require you to adapt your doctests for the new style, but now it makes much more sense for debugging for developers.
- Move zope.testing to "test" extras_require, as it is not needed for zope.schema itself.
- Change the order of classes in SET_TYPES tuple, introduced in previous release to one that was in 3.4 (SetType, set), because third-party code could be dependent on that order. The one example is z3c.form's converter.
- Add the doctests to the long description.
- Remove use of deprecated 'sets' module when running under Python 2.6.
- Remove spurious doctest failure when running under Python 2.6.
- Add support to bootstrap on Jython.
- Add helper methods for schema validation:
getValidationErrors
andgetSchemaValidationErrors
. - zope.schema now works on Python2.5
Add BeforeObjectAssignedEvent that is triggered before the object field sets a value.
Corresponds to the version of the zope.schema package shipped as part of the Zope 3.3.0 release.
Corresponds to the version of the zope.schema package shipped as part of the Zope 3.2.1 release.
Fix missing import of 'VocabularyRegistryError'. See http://www.zope.org/Collectors/Zope3-dev/544 .
Corresponds to the version of the zope.schema package shipped as part of the Zope 3.2.0 release.
Add "iterable" sources to replace vocabularies, which are now deprecated and scheduled for removal in Zope 3.3.
Corresponds to the version of the zope.schema package shipped as part of the Zope 3.1.0 release.
Allow 'Choice' fields to take either a 'vocabulary' or a 'source' argument (sources are a simpler implementation).
Add 'TimeDelta' and 'ASCIILine' field types.
Corresponds to the version of the zope.schema package shipped as part of the Zope X3.0.0 release.