On Mar 15, 11:29 pm, "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.
1st. You could replace JumpMenu to SingleSelectField widget and check
if its the JumpMenu problem.
Since these two widgets are very similar.
2nd. If they both not work right for you, it might be your syntax
problem, open $tg-admin toolbox and check in the widget browser.
.JumpMenu(name='Main Menu',
> options = [('/createNewBatch', 'Create New Batch',
> [])])
# JumpMenu("your_jump_menu_field",
# options=[('http://www.python.org',
"Python"),
# ('http://www.turbogears.org',
"TurboGears"),
# ('http://www.python.org/pypi',
"Cheese Shop"),
# ('http://www.pythonware.com/
daily/', "Daily Python")],
# #default='http://www.turbogears.org'
# )
I think it's the point, your syntax doesn't right though.
3rd.(optional) you don't need to wrap JumpMenu in the WidgetsList,
since JumpMenu could be work independently.
--
Fred
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---