Do you have a longer traceback? It would help to know which line in 
tools.py is causing the problem.

It is true that Auth assumes the id field for auth tables to be called id. 
Perhaps this can be changed. 

Massimo

On Wednesday, 11 July 2012 01:10:17 UTC-5, Jerry wrote:
>
> Hello,
>
> I have a legacy MS SQL db with a User table with lots of old data:
>
> db3.define_table('People',
>     Field('People_ID', 'id'),
>     Field('LastName', length=50),
>     Field('FirstName', length=50),
> ........
>     migrate = False
> )
> custom_auth_table = db3['People']
>
> # tell Auth to use this table
> auth.settings.table_user = custom_auth_table 
>
> # have Auth create the group, membership etc. tables
> auth.define_tables()
>
> I can view tables, including the legacy People via Admin - the new auth 
> tables don't contain any data - and create a new group in auth_group no 
> problem.
>
> When I try to insert a new auth_membership:
> /appadmin/insert/db3/auth_membership
> CPU utilization goes to 100% for a couple of seconds and I get an error:
>
>   File "\web2py\gluon\dal.py", line 5648, in __getitem__
>     return dict.__getitem__(self, key)
> KeyError: 'id'
>
> Variables self <Row {'auth_event': <gluon.dal.Set object at 
> 0x0...lete_record': <function <lambda> at 0x08A866B0>}>  dict.__getitem__ 
> <method 
> '__getitem__' of 'dict' objects>  builtindict <type 'dict'>  key 'id'
> I suspect the error has something to do with the 'id' field of the User 
> table ('People') being 'People_ID' instead of 'id'.
> However looking at the db auth_membership table definition, the 'user_id' 
> column seems correct - a Foreign Key pointing to 'People' / 'People_ID'.
> I'm stumped.
>
> Any ideas?
>
> Thanks,
>
> Jerry.
>

Reply via email to