Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 463 lines (313 sloc) 15.414 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
Changes
=======

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/issues#issue/5.

- Allow ``default_tzinfo`` to be ``None`` when creating a
  ``colander.DateTime``. See
  https://github.com/Pylons/colander/issues#issue/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.
Something went wrong with that request. Please try again.