Thank you all for your help. My problem is that -as Diez points out- I
completely botched the definition of mainMenuForm. Simply
instantiating class MainMenuForm was not correct. What I did that
worked was to define mainMenuForm as follows:
mainMenuForm = widgets.TableForm(fields=MainMenuForm(),
submit_text='Create New Batch')
This is close to Diez's suggestion except instead of creating a List
Form, I opted to create a Table Form. The only reason for this is that
I have been trying to understand Turbogears mostly from the Prentice
Hall book and that's what they show on page 68. Thanks to Diez, I now
understand that Table Form is just one of several forms I can use.
Again, thank you all. This has been very helpful to a newbie like
myself.
On Mar 15, 8:29 am, "MikeC" <[EMAIL PROTECTED]> wrote:
> 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 tohttp://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()}
>
> Please explain what I'm doing wrong.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---