MikeC schrieb:
> I am very new to Turbogears. I have the following controllers.py code
> fragments.
> 
> 
>                       ...
>                       ...
>                       ...
> class MainMenuForm(widgets.WidgetsList):
>       jumpMenu = widgets.JumpMenu(name='Main Menu',
>                       options = [('/createNewBatch', 'Create New Batch', [])])
> mainMenuForm = MainMenuForm()
>                       ...
>                       ...
>                       ...
> class Root(controllers.RootController):
>                       ...
>                       ...
>                       ...
>       @expose(template="remoteremittance_tg.templates.main")
>       def index(self, *args, **kw):
>                       ...
>                       ...
>                       ...
>               return dict(form=mainMenuForm)
> 
> 
> 
> My main.kid looks like this...
> 
> 
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
> www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml"; xmlns:py="http://purl.org/
> kid/ns#">
> <meta content="text/html; charset=utf-8" http-equiv="Content-Typ!"
> py:replace="''"/>
> <head>
>       <title>Remote Remittance Main Menu</title>
> </head>
> <body>
>       ${form()}
> </body>
> </html>
> 
> 
> When I navigate to http://localhost:8080, I get a traceback showing in
> my browser. Here is a fragment of that traceback.
> 
>                       ...
>                       ...
>                       ...
> File "c:\python24\lib\site-packages\kid-0.9.5-py2.4.egg\kid
> \parser.py", line 219, in _coalesce
>     for ev, item in stream:
>   File "H:\Applications\MSS\RemoteRemittances\Software
> \RemoteRemittance-Tg\remoteremittance_tg\templates\main.py", line 57,
> in _pull
> TypeError: 'MainMenuForm' object is not callable
> Error location in template file 'H:\\Applications\\MSS\
> \RemoteRemittances\\Software\\RemoteRemittance-Tg\\remoteremittance_tg\
> \templates\\main.kid'
> between line 7 and line 8:
> <body>
>       ${form()}

As the error message says - form is not callable. It's just a list. What 
you need to do is to create an actualy form-widget that has it's 
field-property set to an instance of MainMenuForm:


@expose(...)
def controller_method(self, ...):
     form = widgets.ListForm(fields=MainMenuForm())
     return dict(form=form)


This is pretty basic stuff btw, take a deeper look at the examples.

Diez

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to