Figured out it was because the line should read as follows: <td>{{=db(db.users.id == result.author).select()[0].name}}</td>
On Apr 21, 2:43 pm, waTR <roman.proje...@gmail.com> wrote: > I am trying toselecta name in a table called users and display it in > a view for loop. However, I get thrown an error in the view regarding > syntax. I have tried displaying the contents of "result" and it does > contain rows. The only thing that does not work is the line below. If > I remove it, the rest of the data displays no problem. NOTE: I have > not included the other data I am grabbing from thedbin the below > because it was irrelevant. I have narrowed down the problem to this > onedb.select. > > Here is what I have: > > #######CONTROLLER:###### > def test(): > results=db().select(db.users.ALL) > return dict(results=results) > > #######VIEW:######## > <table> > {{for result in results:}} > <tr> > <td>{{=db(db.users.id == result.author).select(db.users.name)[0]}}</ > td> > </tr> > {{pass}} > </table> > > ###### ERROR: ####### > Traceback (most recent call last): > File "gluon/restricted.py", line 98, in restricted > File "/Users/rom/Documents/Computers/Projects/web2py practice/web2py/ > web2py.app/Contents/Resources/applications/tripplanet/views/root/ > h.html", line 78, in <module> > File "gluon/globals.py", line 84, in write > File "gluon/html.py", line 89, in xmlescape > File "gluon/sql.py", line 496, in __getattr__ > File "gluon/sql.py", line 490, in __getitem__ > KeyError: 'xml' --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---