Pylons / deform

A Python HTML form library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: serialize() missing 1 required positional argument: 'appstruct'

eltonplima opened this issue · comments

Based on this example: http://pyramid-tutorials.readthedocs.org/en/latest/humans/zodb/index.html

I wrote this code: http://pastebin.com/tj2hdWXi

But, when call the view i get this error: TypeError: serialize() missing 1 required positional argument: 'appstruct'

The full traceback is here: http://pastebin.com/v5LN9XBK

The error is a bit weird, but the issue in your code is that you need to instantiate the node types in your schema. Instead of:

class GameSchema(colander.MappingSchema):
    name = colander.SchemaNode(colander.String)
    launch_date = colander.SchemaNode(colander.Date)
    genre = colander.SchemaNode(colander.String)

it should be:

class GameSchema(colander.MappingSchema):
    name = colander.SchemaNode(colander.String())
    launch_date = colander.SchemaNode(colander.Date())
    genre = colander.SchemaNode(colander.String())

Check out the examples on http://deformdemo.repoze.org/