Hello,
I'm trying to convert my tg2 tw1 form to pyramid tw2

I have a
myapp/widget.py
-------------------------------

from tw2.forms import TableForm, TextField, CalendarDatePicker,
SingleSelectField, TextArea
import tw2

class AddressForm(TableForm):
    title='MyApp Add Address Form'
    # This WidgetsList is just a container
    #class fields(WidgetsList):
    FirstName = TextField(validator=tw2.core.Required)
    LastName = TextField(validator=tw2.core.Required)
    MaidenLastName = TextField(validator=String)
    Email = TextField(validator=tw2.core.EmailValidator)
    Address = TextField(validator=tw2.core.Required)
    City = TextField(validator=tw2.core.Required)
    State = TextField(validator=tw2.core.Required)

In my view.py
-------------------------

@view_config(route_name='add', renderer='templates/add.pt')
def add_view(request):
    context='myapp.widget.AddressForm'
    return {'widget':context,'project':'myapp'}


In __init__.py
------------------------
 config.add_route('add', '/add')


and add.pt
------------------
<div tal:content="structure widget.display()"></div>


but I get this error message? What is my error?
----------------------------------------------------------------------

chameleon.utils.TypeError

TypeError: string indices must be integers, not str

 - Expression: "widget.display()"
 - Filename:   /home/lucas/tmp/pyramid/myapp/myapp/templates/add.pt
 - Location:   (28:29)

 - Source:     ... v tal:content="structure widget.display()"></div>
                                            ^^^^^^^^^^^^^^^^
 - Arguments:  widget: myapp.widget.AddressForm
               repeat: {...} (0)
               renderer_name: templates/add.pt
               req: <Request - at 0x3eada10>
               request: <Request - at 0x3eada10>
               project: myapp
               renderer_info: <RendererHelper - at 0x3c59810>
               context: <instance None at 0x3eabb00>
               escape: False
               view: <function add_view at 0x3c97230>


Any idea why this is not working. The sample documentation is not
really easy to read and follow.

Thanks,
Lucas

-- 
You received this message because you are subscribed to the Google Groups 
"ToscaWidgets-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/toscawidgets-discuss?hl=en.

Reply via email to