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