hi all, I'm going over the widgets tutorial and got a very weird error, which turn out to be a typo on my side.

although I still think it's too criptic and under all the code will make newbies run away.

the error

Page handler: <bound method Root.index of <fooball.controllers.Root object at 0xb730694c>>
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/CherryPy- 2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 105, in _run
self.main()
File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 254, in main
body = page_handler(*virtual_path, ** self.params)
File "<string>", line 3, in index
File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/controllers.py", line 273, in expose
output = database.run_with_transaction (
File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/database.py", line 221, in run_with_transaction
retval = func(*args, **kw)
File "<string>", line 5, in _expose
File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/controllers.py", line 290, in <lambda>
mapping, fragment, *args, **kw)))
File "/usr/lib/python2.4/site-packages/TurboGears- 0.9a6-py2.4.egg/turbogears/controllers.py", line 314, in _execute_func
output = errorhandling.try_call(func, *args, **kw)
File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/errorhandling.py", line 71, in try_call
return func(self, *args, **kw)
File "/home/elpargo/python/tg/fooball/fooball/controllers.py", line 17, in index
player_fields = [('Name','name'),
TypeError: 'tuple' object is not callable

first hint was no reference at all to the widget.



the root controller

class Root(controllers.RootController):
    @expose(template="fooball.templates.welcome")
    def index(self):
        player_fields = [('Name','name'),
                        ('Birth Date','birthdate'),
                        ('Team','team')
                        ('Points','points')]
        return dict(teams= Team.select(),
                    players=Player.select(),
                    players_widget=widgets.DataGrid(fields=player_fields))


saw the typo? I didn't for some minutes still lost check this out

>>> li=[(1,1),(2,2)(3,3)]
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: 'tuple' object is not callable

so it's calling the tuple object (2,2) with parameters (3,3)

--------------------
now with widgets having that list of tuples as a very common way, and missing a comma being such a common mistake (please not that this is not a syntax error)


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to