diff --git a/docs/basics.rst b/docs/basics.rst index aee7b82..83c862c 100644 --- a/docs/basics.rst +++ b/docs/basics.rst @@ -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)