There should be only one
db = DAL('postgres://.........)
in db_0.py.
because in your case db.company and db.auth_user are in the same
database and they need a single connection object.
On Sep 14, 2:21 am, annet <[email protected]> wrote:
> I have a db.py file which contains things like from
> applications.bas.modules.mywidgets import * etc. a db_00.py file which
> contains table definitions and a db_01.py file which contains
> everything related to access control.
>
> In db_01.py I defined a custom auth_user table which contains a
> reference to a table in db_00.py. When I uncomment
> auth.define_tables(username=True) and save the file I get a KeyError
> on company:
>
> auth.settings.table_user = db.define_table('auth_user',
> Field(...),
> Field('company_id',db.company),
> Field())
>
> ... where company references the company table defined in db_00.py.
> The connection string both in db_00.py and db._01.py read like:
>
> db = DAL('postgres://.........)
>
> Why do I get this error?
>
> Kind regards,
>
> Annet.