Hello community, here is the log from the commit of package python-zope.schema for openSUSE:Factory checked in at 2020-03-11 18:43:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-zope.schema (Old) and /work/SRC/openSUSE:Factory/.python-zope.schema.new.3160 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-zope.schema" Wed Mar 11 18:43:31 2020 rev:12 rq:782885 version:5.0.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-zope.schema/python-zope.schema.changes 2019-10-16 09:17:19.631151823 +0200 +++ /work/SRC/openSUSE:Factory/.python-zope.schema.new.3160/python-zope.schema.changes 2020-03-11 18:46:17.319411943 +0100 @@ -1,0 +2,16 @@ +Mon Mar 9 10:24:34 UTC 2020 - [email protected] + +- update to version 5.0.1 + - 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`` attributes ``min``, ``max`` and ``default`` as ``Decimal`` + type instead of ``Number``. + See `issue 88 <https://github.com/zopefoundation/zope.schema/issues/88>`_. + - Enable unicode normalization for ``Text`` fields. + The default is NFC normalization. Valid forms are 'NFC', 'NFKC', 'NFD', and + 'NFKD'. To disable normalization, set ``unicode_normalization`` to ``False`` + or ``None`` when calling ``__init__`` of the ``Text`` field. + See `issue 86 <https://github.com/zopefoundation/zope.schema/issues/86>`_. + +------------------------------------------------------------------- Old: ---- zope.schema-4.9.3.tar.gz New: ---- zope.schema-5.0.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-zope.schema.spec ++++++ --- /var/tmp/diff_new_pack.g4jtoa/_old 2020-03-11 18:46:23.867415961 +0100 +++ /var/tmp/diff_new_pack.g4jtoa/_new 2020-03-11 18:46:23.871415964 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-zope.schema # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -26,7 +26,7 @@ %bcond_with test %endif Name: python-zope.schema%{psuffix} -Version: 4.9.3 +Version: 5.0.1 Release: 0 Summary: Zope interface extension for defining data schemas License: ZPL-2.1 ++++++ zope.schema-4.9.3.tar.gz -> zope.schema-5.0.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zope.schema-4.9.3/CHANGES.rst new/zope.schema-5.0.1/CHANGES.rst --- old/zope.schema-4.9.3/CHANGES.rst 2018-10-12 14:26:23.000000000 +0200 +++ new/zope.schema-5.0.1/CHANGES.rst 2020-03-06 15:45:32.000000000 +0100 @@ -2,11 +2,33 @@ Changes ========= +5.0.1 (2020-03-06) +================== + +- Fix: add ``Text.unicode_normalization = 'NFC'`` as default, because some are + persisting schema fields. Setting that attribute only in ``__init__`` + breaks loading old objects. + + +5.0 (2020-03-06) +================ + +- Set ``IDecimal`` attributes ``min``, ``max`` and ``default`` as ``Decimal`` + type instead of ``Number``. + See `issue 88 <https://github.com/zopefoundation/zope.schema/issues/88>`_. + +- Enable unicode normalization for ``Text`` fields. + The default is NFC normalization. Valid forms are 'NFC', 'NFKC', 'NFD', and + 'NFKD'. To disable normalization, set ``unicode_normalization`` to ``False`` + or ``None`` when calling ``__init__`` of the ``Text`` field. + See `issue 86 <https://github.com/zopefoundation/zope.schema/issues/86>`_. + + 4.9.3 (2018-10-12) ================== -- Fixed a ReST error in getDoc() results when having "subfields" - with titles. +- Fix a ReST error in getDoc() results when having "subfields" + with titles. 4.9.2 (2018-10-11) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zope.schema-4.9.3/PKG-INFO new/zope.schema-5.0.1/PKG-INFO --- old/zope.schema-4.9.3/PKG-INFO 2018-10-12 14:26:23.000000000 +0200 +++ new/zope.schema-5.0.1/PKG-INFO 2020-03-06 15:45:33.000000000 +0100 @@ -1,12 +1,11 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: zope.schema -Version: 4.9.3 +Version: 5.0.1 Summary: zope.interface extension for defining data schemas Home-page: https://github.com/zopefoundation/zope.schema Author: Zope Foundation and Contributors Author-email: [email protected] License: ZPL 2.1 -Description-Content-Type: UNKNOWN Description: ============= zope.schema ============= @@ -47,11 +46,33 @@ Changes ========= + 5.0.1 (2020-03-06) + ================== + + - Fix: add ``Text.unicode_normalization = 'NFC'`` as default, because some are + persisting schema fields. Setting that attribute only in ``__init__`` + breaks loading old objects. + + + 5.0 (2020-03-06) + ================ + + - Set ``IDecimal`` attributes ``min``, ``max`` and ``default`` as ``Decimal`` + type instead of ``Number``. + See `issue 88 <https://github.com/zopefoundation/zope.schema/issues/88>`_. + + - Enable unicode normalization for ``Text`` fields. + The default is NFC normalization. Valid forms are 'NFC', 'NFKC', 'NFD', and + 'NFKD'. To disable normalization, set ``unicode_normalization`` to ``False`` + or ``None`` when calling ``__init__`` of the ``Text`` field. + See `issue 86 <https://github.com/zopefoundation/zope.schema/issues/86>`_. + + 4.9.3 (2018-10-12) ================== - - Fixed a ReST error in getDoc() results when having "subfields" - with titles. + - Fix a ReST error in getDoc() results when having "subfields" + with titles. 4.9.2 (2018-10-11) @@ -640,5 +661,7 @@ Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy -Classifier: Framework :: Zope3 +Classifier: Framework :: Zope :: 3 Classifier: Topic :: Software Development :: Libraries :: Python Modules +Provides-Extra: test +Provides-Extra: docs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zope.schema-4.9.3/docs/fields.rst new/zope.schema-5.0.1/docs/fields.rst --- old/zope.schema-4.9.3/docs/fields.rst 2018-10-12 14:26:23.000000000 +0200 +++ new/zope.schema-5.0.1/docs/fields.rst 2020-03-06 15:45:32.000000000 +0100 @@ -203,6 +203,16 @@ in swallow_duplicates=True when initializing the vocabulary. See the test cases for an example. +Text +---- + +By default NFC unicode normalization is enabled for :class:`zope.schema.Text`. +Valid forms are 'NFC', 'NFKC', 'NFD', and 'NFKD'. + +To set the normalization form, use the parameter ``unicode_normalization`` when +creating the field. Set the parameter to a falsy value to disable unicode +normalization. + URI --- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zope.schema-4.9.3/setup.py new/zope.schema-5.0.1/setup.py --- old/zope.schema-4.9.3/setup.py 2018-10-12 14:26:23.000000000 +0200 +++ new/zope.schema-5.0.1/setup.py 2020-03-06 15:45:32.000000000 +0100 @@ -70,7 +70,7 @@ "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", - "Framework :: Zope3", + "Framework :: Zope :: 3", "Topic :: Software Development :: Libraries :: Python Modules", ], include_package_data=True, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zope.schema-4.9.3/src/zope/schema/_bootstrapfields.py new/zope.schema-5.0.1/src/zope/schema/_bootstrapfields.py --- old/zope.schema-4.9.3/src/zope/schema/_bootstrapfields.py 2018-10-12 14:26:23.000000000 +0200 +++ new/zope.schema-5.0.1/src/zope/schema/_bootstrapfields.py 2020-03-06 15:45:32.000000000 +0100 @@ -20,6 +20,7 @@ import numbers import sys import threading +import unicodedata from math import isinf from zope.interface import Attribute @@ -504,11 +505,14 @@ class Text(MinMaxLen, Field): """A field containing text used for human discourse.""" _type = text_type + unicode_normalization = 'NFC' - def __init__(self, *args, **kw): + def __init__(self, *args, **kw): + self.unicode_normalization = kw.pop( + 'unicode_normalization', self.unicode_normalization) super(Text, self).__init__(*args, **kw) - def fromUnicode(self, str): + def fromUnicode(self, value): """ >>> from zope.schema.interfaces import WrongType >>> from zope.schema.interfaces import ConstraintNotSatisfied @@ -529,8 +533,11 @@ ... zope.schema._bootstrapinterfaces.ConstraintNotSatisfied: (u'foo spam', '') """ - self.validate(str) - return str + if isinstance(value, text_type): + if self.unicode_normalization: + value = unicodedata.normalize(self.unicode_normalization, value) + self.validate(value) + return value class TextLine(Text): @@ -896,6 +903,69 @@ _unicode_converters = (int,) +class InvalidDecimalLiteral(ValueError, ValidationError): + "Raised by decimal fields" + + +class Decimal(Number): + """ + A field representing a native :class:`decimal.Decimal` and implementing + :class:`zope.schema.interfaces.IDecimal`. + + The :meth:`fromUnicode` method only accepts values that can be parsed + by the ``Decimal`` constructor:: + + >>> from zope.schema._field import Decimal + >>> f = Decimal() + >>> f.fromUnicode("1") + Decimal('1') + >>> f.fromUnicode("125.6") + Decimal('125.6') + >>> f.fromUnicode("1+0j") # doctest: +IGNORE_EXCEPTION_DETAIL + Traceback (most recent call last): + ... + InvalidDecimalLiteral: Invalid literal for Decimal(): 1+0j + >>> f.fromUnicode("1/2") # doctest: +IGNORE_EXCEPTION_DETAIL + Traceback (most recent call last): + ... + InvalidDecimalLiteral: Invalid literal for Decimal(): 1/2 + >>> f.fromUnicode(str(2**31234) + '.' + str(2**256)) # doctest: +ELLIPSIS + Decimal('2349...936') + >>> f.fromUnicode("not a number") # doctest: +IGNORE_EXCEPTION_DETAIL + Traceback (most recent call last): + ... + InvalidDecimalLiteral: could not convert string to float: not a number + + Likewise for :meth:`fromBytes`:: + + >>> from zope.schema._field import Decimal + >>> f = Decimal() + >>> f.fromBytes(b"1") + Decimal('1') + >>> f.fromBytes(b"125.6") + Decimal('125.6') + >>> f.fromBytes(b"1+0j") # doctest: +IGNORE_EXCEPTION_DETAIL + Traceback (most recent call last): + ... + InvalidDecimalLiteral: Invalid literal for Decimal(): 1+0j + >>> f.fromBytes(b"1/2") # doctest: +IGNORE_EXCEPTION_DETAIL + Traceback (most recent call last): + ... + InvalidDecimalLiteral: Invalid literal for Decimal(): 1/2 + >>> f.fromBytes((str(2**31234) + '.' + str(2**256)).encode("ascii")) # doctest: +ELLIPSIS + Decimal('2349...936') + >>> f.fromBytes(b"not a number") # doctest: +IGNORE_EXCEPTION_DETAIL + Traceback (most recent call last): + ... + InvalidDecimalLiteral: could not convert string to float: not a number + + + """ + _type = decimal.Decimal + _unicode_converters = (decimal.Decimal,) + _validation_error = InvalidDecimalLiteral + + class _ObjectsBeingValidated(threading.local): def __init__(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zope.schema-4.9.3/src/zope/schema/_field.py new/zope.schema-5.0.1/src/zope/schema/_field.py --- old/zope.schema-4.9.3/src/zope/schema/_field.py 2018-10-12 14:26:23.000000000 +0200 +++ new/zope.schema-5.0.1/src/zope/schema/_field.py 2020-03-06 15:45:32.000000000 +0100 @@ -25,7 +25,6 @@ from datetime import date from datetime import timedelta from datetime import time -import decimal import re @@ -106,6 +105,8 @@ from zope.schema._bootstrapfields import Int from zope.schema._bootstrapfields import Integral from zope.schema._bootstrapfields import Number +from zope.schema._bootstrapfields import InvalidDecimalLiteral # reimport +from zope.schema._bootstrapfields import Decimal from zope.schema._bootstrapfields import Password from zope.schema._bootstrapfields import Rational from zope.schema._bootstrapfields import Real @@ -147,6 +148,7 @@ classImplements(Rational, IRational) classImplements(Integral, IIntegral) classImplements(Int, IInt) +classImplements(Decimal, IDecimal) classImplements(Object, IObject) @@ -315,70 +317,6 @@ _validation_error = InvalidFloatLiteral -class InvalidDecimalLiteral(ValueError, ValidationError): - "Raised by decimal fields" - - -@implementer(IDecimal) -class Decimal(Number): - """ - A field representing a native :class:`decimal.Decimal` and implementing - :class:`zope.schema.interfaces.IDecimal`. - - The :meth:`fromUnicode` method only accepts values that can be parsed - by the ``Decimal`` constructor:: - - >>> from zope.schema._field import Decimal - >>> f = Decimal() - >>> f.fromUnicode("1") - Decimal('1') - >>> f.fromUnicode("125.6") - Decimal('125.6') - >>> f.fromUnicode("1+0j") # doctest: +IGNORE_EXCEPTION_DETAIL - Traceback (most recent call last): - ... - InvalidDecimalLiteral: Invalid literal for Decimal(): 1+0j - >>> f.fromUnicode("1/2") # doctest: +IGNORE_EXCEPTION_DETAIL - Traceback (most recent call last): - ... - InvalidDecimalLiteral: Invalid literal for Decimal(): 1/2 - >>> f.fromUnicode(str(2**31234) + '.' + str(2**256)) # doctest: +ELLIPSIS - Decimal('2349...936') - >>> f.fromUnicode("not a number") # doctest: +IGNORE_EXCEPTION_DETAIL - Traceback (most recent call last): - ... - InvalidDecimalLiteral: could not convert string to float: not a number - - Likewise for :meth:`fromBytes`:: - - >>> from zope.schema._field import Decimal - >>> f = Decimal() - >>> f.fromBytes(b"1") - Decimal('1') - >>> f.fromBytes(b"125.6") - Decimal('125.6') - >>> f.fromBytes(b"1+0j") # doctest: +IGNORE_EXCEPTION_DETAIL - Traceback (most recent call last): - ... - InvalidDecimalLiteral: Invalid literal for Decimal(): 1+0j - >>> f.fromBytes(b"1/2") # doctest: +IGNORE_EXCEPTION_DETAIL - Traceback (most recent call last): - ... - InvalidDecimalLiteral: Invalid literal for Decimal(): 1/2 - >>> f.fromBytes((str(2**31234) + '.' + str(2**256)).encode("ascii")) # doctest: +ELLIPSIS - Decimal('2349...936') - >>> f.fromBytes(b"not a number") # doctest: +IGNORE_EXCEPTION_DETAIL - Traceback (most recent call last): - ... - InvalidDecimalLiteral: could not convert string to float: not a number - - - """ - _type = decimal.Decimal - _unicode_converters = (decimal.Decimal,) - _validation_error = InvalidDecimalLiteral - - @implementer(IDatetime) class Datetime(Orderable, Field): __doc__ = IDatetime.__doc__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zope.schema-4.9.3/src/zope/schema/interfaces.py new/zope.schema-5.0.1/src/zope/schema/interfaces.py --- old/zope.schema-4.9.3/src/zope/schema/interfaces.py 2018-10-12 14:26:23.000000000 +0200 +++ new/zope.schema-5.0.1/src/zope/schema/interfaces.py 2020-03-06 15:45:32.000000000 +0100 @@ -23,6 +23,7 @@ from zope.schema._bootstrapfields import Bool from zope.schema._bootstrapfields import Complex +from zope.schema._bootstrapfields import Decimal from zope.schema._bootstrapfields import Field from zope.schema._bootstrapfields import Int from zope.schema._bootstrapfields import Integral @@ -644,6 +645,24 @@ class IDecimal(INumber): """Field containing a :class:`decimal.Decimal`""" + min = Decimal( + title=_("Start of the range"), + required=False, + default=None + ) + + max = Decimal( + title=_("End of the range (including the value itself)"), + required=False, + default=None + ) + + default = Decimal( + title=_("Default Value"), + description=_("""The field default value may be None or a legal + field value""") + ) + ### # End numbers ### diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zope.schema-4.9.3/src/zope/schema/tests/test__bootstrapfields.py new/zope.schema-5.0.1/src/zope/schema/tests/test__bootstrapfields.py --- old/zope.schema-4.9.3/src/zope/schema/tests/test__bootstrapfields.py 2018-10-12 14:26:23.000000000 +0200 +++ new/zope.schema-5.0.1/src/zope/schema/tests/test__bootstrapfields.py 2020-03-06 15:45:32.000000000 +0100 @@ -11,8 +11,10 @@ # FOR A PARTICULAR PURPOSE. # ############################################################################## +import decimal import doctest import unittest +import unicodedata # pylint:disable=protected-access,inherit-non-class,blacklisted-name @@ -958,11 +960,53 @@ self.assertRaisesWrongType(txt.fromUnicode, txt._type, deadbeef) def test_fromUnicode_hit(self): - deadbeef = u'DEADBEEF' txt = self._makeOne() self.assertEqual(txt.fromUnicode(deadbeef), deadbeef) + def test_normalization(self): + deadbeef = unicodedata.normalize('NFD', b'\xc3\x84\xc3\x96\xc3\x9c'.decode('utf-8')) + txt = self._makeOne() + self.assertEqual(txt.unicode_normalization, 'NFC') + self.assertEqual( + [unicodedata.name(c) for c in txt.fromUnicode(deadbeef)], + [ + 'LATIN CAPITAL LETTER A WITH DIAERESIS', + 'LATIN CAPITAL LETTER O WITH DIAERESIS', + 'LATIN CAPITAL LETTER U WITH DIAERESIS', + ] + ) + txt = self._makeOne(unicode_normalization=None) + self.assertEqual(txt.unicode_normalization, None) + self.assertEqual( + [unicodedata.name(c) for c in txt.fromUnicode(deadbeef)], + [ + 'LATIN CAPITAL LETTER A', + 'COMBINING DIAERESIS', + 'LATIN CAPITAL LETTER O', + 'COMBINING DIAERESIS', + 'LATIN CAPITAL LETTER U', + 'COMBINING DIAERESIS', + ] + ) + + def test_normalization_after_pickle(self): + # test an edge case where `Text` is persisted + # see https://github.com/zopefoundation/zope.schema/issues/90 + import pickle + orig_makeOne = self._makeOne + def makeOne(**kwargs): + result = orig_makeOne(**kwargs) + if not kwargs: + # We should have no state to preserve + result.__dict__.clear() + + result = pickle.loads(pickle.dumps(result)) + return result + + self._makeOne = makeOne + self.test_normalization() + class TextLineTests(EqualityTestsMixin, WrongTypeTestsMixin, @@ -1220,10 +1264,7 @@ field.validate(-1) self.assertRaises(RequiredMissing, field.validate, None) - - def test_fromUnicode_miss(self): - txt = self._makeOne() self.assertRaises(ValueError, txt.fromUnicode, u'') self.assertRaises(ValueError, txt.fromUnicode, u'False') @@ -1253,6 +1294,62 @@ self.assertEqual(txt._type, integer_types) +class DecimalTests(NumberTests): + + mvm_missing_value = decimal.Decimal("-1") + mvm_default = decimal.Decimal("0") + + MIN = decimal.Decimal(NumberTests.MIN) + MAX = decimal.Decimal(NumberTests.MAX) + VALID = tuple(decimal.Decimal(x) for x in NumberTests.VALID) + TOO_SMALL = tuple(decimal.Decimal(x) for x in NumberTests.TOO_SMALL) + TOO_BIG = tuple(decimal.Decimal(x) for x in NumberTests.TOO_BIG) + + def _getTargetClass(self): + from zope.schema._bootstrapfields import Decimal + return Decimal + + def _getTargetInterface(self): + from zope.schema.interfaces import IDecimal + return IDecimal + + def test_validate_not_required(self): + field = self._makeOne(required=False) + field.validate(decimal.Decimal("10.0")) + field.validate(decimal.Decimal("0.93")) + field.validate(decimal.Decimal("1000.0003")) + field.validate(None) + + def test_validate_required(self): + from zope.schema.interfaces import RequiredMissing + field = self._makeOne() + field.validate(decimal.Decimal("10.0")) + field.validate(decimal.Decimal("0.93")) + field.validate(decimal.Decimal("1000.0003")) + self.assertRaises(RequiredMissing, field.validate, None) + + def test_fromUnicode_miss(self): + from zope.schema.interfaces import ValidationError + flt = self._makeOne() + self.assertRaises(ValueError, flt.fromUnicode, u'') + self.assertRaises(ValueError, flt.fromUnicode, u'abc') + with self.assertRaises(ValueError) as exc: + flt.fromUnicode(u'1.4G') + + value_error = exc.exception + self.assertIs(value_error.field, flt) + self.assertEqual(value_error.value, u'1.4G') + self.assertIsInstance(value_error, ValidationError) + + def test_fromUnicode_hit(self): + from decimal import Decimal + + flt = self._makeOne() + self.assertEqual(flt.fromUnicode(u'0'), Decimal('0.0')) + self.assertEqual(flt.fromUnicode(u'1.23'), Decimal('1.23')) + self.assertEqual(flt.fromUnicode(u'12345.6'), Decimal('12345.6')) + + class ObjectTests(EqualityTestsMixin, WrongTypeTestsMixin, unittest.TestCase): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zope.schema-4.9.3/src/zope/schema/tests/test__field.py new/zope.schema-5.0.1/src/zope/schema/tests/test__field.py --- old/zope.schema-4.9.3/src/zope/schema/tests/test__field.py 2018-10-12 14:26:23.000000000 +0200 +++ new/zope.schema-5.0.1/src/zope/schema/tests/test__field.py 2020-03-06 15:45:32.000000000 +0100 @@ -12,7 +12,6 @@ # ############################################################################## import datetime -import decimal import doctest import unittest @@ -314,62 +313,6 @@ self.assertEqual(flt.fromUnicode(u'1.23e6'), 1230000.0) -class DecimalTests(NumberTests): - - mvm_missing_value = decimal.Decimal("-1") - mvm_default = decimal.Decimal("0") - - MIN = decimal.Decimal(NumberTests.MIN) - MAX = decimal.Decimal(NumberTests.MAX) - VALID = tuple(decimal.Decimal(x) for x in NumberTests.VALID) - TOO_SMALL = tuple(decimal.Decimal(x) for x in NumberTests.TOO_SMALL) - TOO_BIG = tuple(decimal.Decimal(x) for x in NumberTests.TOO_BIG) - - def _getTargetClass(self): - from zope.schema._field import Decimal - return Decimal - - def _getTargetInterface(self): - from zope.schema.interfaces import IDecimal - return IDecimal - - def test_validate_not_required(self): - field = self._makeOne(required=False) - field.validate(decimal.Decimal("10.0")) - field.validate(decimal.Decimal("0.93")) - field.validate(decimal.Decimal("1000.0003")) - field.validate(None) - - def test_validate_required(self): - from zope.schema.interfaces import RequiredMissing - field = self._makeOne() - field.validate(decimal.Decimal("10.0")) - field.validate(decimal.Decimal("0.93")) - field.validate(decimal.Decimal("1000.0003")) - self.assertRaises(RequiredMissing, field.validate, None) - - def test_fromUnicode_miss(self): - from zope.schema.interfaces import ValidationError - flt = self._makeOne() - self.assertRaises(ValueError, flt.fromUnicode, u'') - self.assertRaises(ValueError, flt.fromUnicode, u'abc') - with self.assertRaises(ValueError) as exc: - flt.fromUnicode(u'1.4G') - - value_error = exc.exception - self.assertIs(value_error.field, flt) - self.assertEqual(value_error.value, u'1.4G') - self.assertIsInstance(value_error, ValidationError) - - def test_fromUnicode_hit(self): - from decimal import Decimal - - flt = self._makeOne() - self.assertEqual(flt.fromUnicode(u'0'), Decimal('0.0')) - self.assertEqual(flt.fromUnicode(u'1.23'), Decimal('1.23')) - self.assertEqual(flt.fromUnicode(u'12345.6'), Decimal('12345.6')) - - class DatetimeTests(OrderableMissingValueMixin, OrderableTestsMixin, EqualityTestsMixin, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zope.schema-4.9.3/src/zope.schema.egg-info/PKG-INFO new/zope.schema-5.0.1/src/zope.schema.egg-info/PKG-INFO --- old/zope.schema-4.9.3/src/zope.schema.egg-info/PKG-INFO 2018-10-12 14:26:23.000000000 +0200 +++ new/zope.schema-5.0.1/src/zope.schema.egg-info/PKG-INFO 2020-03-06 15:45:33.000000000 +0100 @@ -1,12 +1,11 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: zope.schema -Version: 4.9.3 +Version: 5.0.1 Summary: zope.interface extension for defining data schemas Home-page: https://github.com/zopefoundation/zope.schema Author: Zope Foundation and Contributors Author-email: [email protected] License: ZPL 2.1 -Description-Content-Type: UNKNOWN Description: ============= zope.schema ============= @@ -47,11 +46,33 @@ Changes ========= + 5.0.1 (2020-03-06) + ================== + + - Fix: add ``Text.unicode_normalization = 'NFC'`` as default, because some are + persisting schema fields. Setting that attribute only in ``__init__`` + breaks loading old objects. + + + 5.0 (2020-03-06) + ================ + + - Set ``IDecimal`` attributes ``min``, ``max`` and ``default`` as ``Decimal`` + type instead of ``Number``. + See `issue 88 <https://github.com/zopefoundation/zope.schema/issues/88>`_. + + - Enable unicode normalization for ``Text`` fields. + The default is NFC normalization. Valid forms are 'NFC', 'NFKC', 'NFD', and + 'NFKD'. To disable normalization, set ``unicode_normalization`` to ``False`` + or ``None`` when calling ``__init__`` of the ``Text`` field. + See `issue 86 <https://github.com/zopefoundation/zope.schema/issues/86>`_. + + 4.9.3 (2018-10-12) ================== - - Fixed a ReST error in getDoc() results when having "subfields" - with titles. + - Fix a ReST error in getDoc() results when having "subfields" + with titles. 4.9.2 (2018-10-11) @@ -640,5 +661,7 @@ Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy -Classifier: Framework :: Zope3 +Classifier: Framework :: Zope :: 3 Classifier: Topic :: Software Development :: Libraries :: Python Modules +Provides-Extra: test +Provides-Extra: docs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zope.schema-4.9.3/version.txt new/zope.schema-5.0.1/version.txt --- old/zope.schema-4.9.3/version.txt 2018-10-12 14:26:23.000000000 +0200 +++ new/zope.schema-5.0.1/version.txt 2020-03-06 15:45:32.000000000 +0100 @@ -1 +1 @@ -4.9.3 +5.0.1
