fields=(db.Organization.name <http://db.organization.name/>)
should be
fields=(db.Organization.name <http://db.organization.name/>, ) # <<<
the commma
or
fields=[db.Organization.name <http://db.organization.name/>]
On Wednesday, 11 April 2012 00:37:39 UTC-5, Annet wrote:
>
> Massimo,
>
> Sorry, I clicked the post button, before writing a reply. In the old
> Google Groups I had the option to remove a post, it seems to no longer be
> available.
>
> Anyway, line 56 is the first empty line at the end of addressbook.py
>
> When I create an empty controller and just put the following function in
> it:
>
> # coding: utf8
>
> def index():
> query=(db.Organization.nodeID>2033)
> fields=(db.Organization.name)
> orderby=db.Organization.name
>
> grid=SQLFORM.grid(query,fields=fields,orderby=orderby,sortable=False,create=False,deletable=False,editable=False,\
> searchable=False,paginate=12)
> return dict(grid=grid)
>
>
> I get this ticket when executing the function:
>
> Traceback (most recent call last):
> File "/Library/Python/2.5/site-packages/web2py/gluon/restricted.py", line
> 205, in restricted
> exec ccode in environment
> File
> "/Library/Python/2.5/site-packages/web2py/applications/bootstrap/controllers/mock.py"
> <http://127.0.0.1:8000/admin/default/edit/bootstrap/controllers/mock.py>,
> line 11, in <module>
> File "/Library/Python/2.5/site-packages/web2py/gluon/globals.py", line 173,
> in <lambda>
> self._caller = lambda f: f()
> File
> "/Library/Python/2.5/site-packages/web2py/applications/bootstrap/controllers/mock.py"
> <http://127.0.0.1:8000/admin/default/edit/bootstrap/controllers/mock.py>,
> line 8, in index
> searchable=False,paginate=12)
> File "/Library/Python/2.5/site-packages/web2py/gluon/sqlhtml.py", line
> 1577, in grid
> if field._tablename in tablenames]
> AttributeError: 'Expression' object has no attribute '_tablename'
>
>
> Kind regards,
>
> Annet
>
>
>