all subclasses of SchemaNode need a `typ`

also the docs are confusing with you do:
    from colander import SchemaNode
and then in the same code block you use ``colander.Range``, so I
formalized everything to use ``colander.*`` syntax.
This commit is contained in:
Michael Merickel
2013-11-04 13:35:44 -06:00
parent d7ef46503f
commit fa8829b18e

View File

@@ -170,9 +170,8 @@ The imperative style that looks like this still works, of course:
.. code-block:: python
from colander import SchemaNode
ranged_int = colander.SchemaNode(
typ=colander.Int(),
validator=colander.Range(0, 10),
default=10,
title='Ranged Int'
@@ -182,9 +181,8 @@ But in 1.0a1+, you can alternately now do something like this:
.. code-block:: python
from colander import SchemaNode
class RangedInt(SchemaNode):
class RangedInt(colander.SchemaNode):
typ = colander.Int()
validator = colander.Range(0, 10)
default = 10
title = 'Ranged Int'
@@ -196,9 +194,8 @@ the schemanode subclass instead of plain attributes:
.. code-block:: python
from colander import SchemaNode
class RangedInt(SchemaNode):
class RangedInt(colander.SchemaNode):
typ = colander.Int()
default = 10
title = 'Ranged Int'
@@ -222,9 +219,8 @@ example this will *not* work:
.. code-block:: python
from colander import SchemaNode
class RangedInt(SchemaNode):
class RangedInt(colander.SchemaNode):
typ = colander.Int()
default = 10
title = 'Ranged Int'
@@ -250,9 +246,8 @@ indeed work):
.. code-block:: python
from colander import SchemaNode
class RangedInt(SchemaNode):
class RangedInt(colander.SchemaNode):
typ = colander.Int()
default = 10
title = 'Ranged Int'
@@ -275,9 +270,8 @@ the bind parameters within values that are plain old methods:
.. code-block:: python
from colander import SchemaNode
class RangedInt(SchemaNode):
class RangedInt(colander.SchemaNode):
typ = colander.Int()
default = 10
title = 'Ranged Int'
@@ -297,9 +291,8 @@ attributes of the schemanode that rely on binding variables:
.. code-block:: python
from colander import SchemaNode
class UserIdSchemaNode(SchemaNode):
class UserIdSchemaNode(colander.SchemaNode):
typ = colander.String()
title = 'User Id'
def after_bind(self, node, kw):
@@ -310,9 +303,8 @@ constructor:
.. code-block:: python
from colander import SchemaNode
class RangedInt(SchemaNode):
class RangedInt(colander.SchemaNode):
typ = colander.Int()
default = 10
title = 'Ranged Int'
validator = colander.Range(0, 10)