From 511c4740afaef7ce204257b222acbeefdde73ad0 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 17 Feb 2012 23:52:21 -0500 Subject: [PATCH] blah blah blah --- docs/null.rst | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/docs/null.rst b/docs/null.rst index 5e9439e..9206e56 100644 --- a/docs/null.rst +++ b/docs/null.rst @@ -188,14 +188,15 @@ colander.null null serialized colander.null value null serialized ===================== ===================== =========================== -.. note:: ```` in the above table represents the circumstance - in which a key present in a :class:`colander.MappingSchema` is not - present in a mapping passed to its - :meth:`colander.SchemaNode.serialize` method. In reality, - ```` means exactly the same thing as - :attr:`colanderr.null`, because the :class:`colander.Mapping` type - does the equivalent of ``mapping.get(keyname, colander.null)`` to - find a subvalue during serialization. +.. note:: + + ```` in the above table represents the circumstance in which a + key present in a :class:`colander.MappingSchema` is not present in a + mapping passed to its :meth:`colander.SchemaNode.serialize` method. In + reality, ```` means exactly the same thing as + :attr:`colanderr.null`, because the :class:`colander.Mapping` type does + the equivalent of ``mapping.get(keyname, colander.null)`` to find a + subvalue during serialization. .. _deserializing_null: @@ -229,19 +230,20 @@ a schema, the node will take the following steps: with an explicit ``missing`` value), a :exc:`colander.Invalid` exception will be raised with a message indicating that the field is required. -.. note:: There are differences between serialization and - deserialization involving the :attr:`colander.null` value. During - serialization, if an :attr:`colander.null` value is encountered, - and no valid ``default`` attribute exists on the node related to - the value the *null value* for that node is returned. - Deserialization, however, doesn't use the ``default`` attribute of - the node to find a default deserialization value in the same - circumstance; instead it uses the ``missing`` attribute instead. - Also, if, during deserialization, an :attr:`colander.null` value is - encountered as the value passed to the deserialize method, and no - explicit ``missing`` value exists for the node, a - :exc:`colander.Invalid` exception is raised (:attr:`colander.null` - is not returned, as it is during serialization). +.. note:: + + There are differences between serialization and deserialization involving + the :attr:`colander.null` value. During serialization, if an + :attr:`colander.null` value is encountered, and no valid ``default`` + attribute exists on the node related to the value the *null value* for + that node is returned. Deserialization, however, doesn't use the + ``default`` attribute of the node to find a default deserialization value + in the same circumstance; instead it uses the ``missing`` attribute + instead. Also, if, during deserialization, an :attr:`colander.null` value + is encountered as the value passed to the deserialize method, and no + explicit ``missing`` value exists for the node, a :exc:`colander.Invalid` + exception is raised (:attr:`colander.null` is not returned, as it is + during serialization). Here's an example of a deserialization which uses a ``missing`` value in the schema as a deserialization default value: