tags:

views:

75

answers:

1

when i do the following code:

family_members =db(db.member.id == membership_id).select (db.member.name,db.member.id) family_members.colnames = ('Name ','Membership ID')

It cause the following error "" Traceback (most recent call last): File "/home/abeer/Desktop/web2py/New_version/web2py_src/web2py/gluon/ restricted.py", line 184, in restricted File "/home/abeer/Desktop/resources/web2py/New_version/web2py_src/ web2py/applications/init/views/default/updateMember.html", line 142, in File "/home/abeer/Desktop/web2py/New_version/web2py_src/web2py/gluon/ globals.py", line 112, in write File "/home/abeer/Desktop/web2py/New_version/web2py_src/web2py/gluon/ html.py", line 103, in xmlescape File "/home/abeer/Desktop/web2py/New_version/web2py_src/web2py/gluon/ sql.py", line 3326, in xml File "/home/abeer/Desktop/web2py/New_version/web2py_src/web2py/gluon/ sqlhtml.py", line 980, in init File "/home/abeer/Desktop/web2py/New_version/web2py_src/web2py/gluon/ sql.py", line 621, in getattr KeyError: '_extra'

"" P.s. : when i commented the line (family_members.colnames = ('Name ','Membership ID')) it works fine i dont why??

Thanks

A: 

Do not use colnames. That is a web2py internal. Use db.table.field.label='..' or SQLTABLE(rows,headres={...}) depending o what you need.

mdipierro