I do not understand. db and vui connect to the same database. why not
"vui=db"? Are they defined in two different applications? If they are
defined in the same applications db and vui should be the same
connections else they will not see each other tables.

On Mar 20, 8:38 pm, kike <eacarm...@estudiantes.uci.cu> wrote:
> I have two databases, the first was created by auth, and the second is
> a database with 14 tables, created previusly.
>
> Traceback (most recent call last):
>   File "/home/kike/sbdv/web2py/gluon/restricted.py", line 173, in
> restricted
>   File "/home/kike/Desktop/web2py/applications/SBDV/models/db.py",
> line 58, in <module>
>     Field('second_preference', vul.object_products, label='Preferencia
> Secundaria'))
>   File "/home/kike/sbdv/web2py/gluon/sql.py", line 1270, in
> define_table
>   File "/home/kike/sbdv/web2py/gluon/sql.py", line 1540, in
> _create_references
> SyntaxError: Table: table "object_vendors" does not exist
>
> this is my code:
>
> db = DAL('mysql://root:r...@localhost/usbdv',pool_size=20)
>
> from gluon.tools import *
> auth=Auth(globals(),db)
> auth.settings.hmac_key='sha512:582aedbf-4d01-4f41-81ad-ffb7eed2ada4'
> auth_table=db.define_table(
>     auth.settings.table_user_name,
>     Field('first_name', length=128, label='Nombre(s)'),
>     Field('last_name', length=128, label='Apellidos'),
>     Field('email', length=128, unique=True, label='Correo'),
>     Field('password', 'password', length=256, readable=False,
> label='Contraseña'),
>     Field('registration_key', length=128, writable=False,
> readable=False),
>     Field('preference', vul.object_vendors, label='Preferencia
> Principal'),
>     Field('second_preference', vul.object_products, label='Preferencia
> Secundaria'))
>                              # creates all needed tables
>
> auth_table.first_name.requires=IS_NOT_EMPTY()
> auth_table.last_name.requires=IS_NOT_EMPTY()
> auth_table.password.requires=[CRYPT()]
> auth_table.email.requires=[IS_EMAIL(), IS_NOT_IN_DB(db,
> auth_table.email)]
> auth_table.preference.requires=IS_IN_DB(vul,'object_vendors.id','object_vendors.name')
> auth_table.second_preference=IS_IN_DB(vul,'object_products.id','object_products.name')
> auth.settings.table_user=auth_table
> auth.define_tables()
>
> and this is my declaration for the second databases(previusly
> created):
>
> vul=DAL('mysql://root:r...@localhost/sbdv',pool_size=20)
>
> vul.define_table('object_vendors', migrate=False)
> vul.define_table('object_products', migrate=False)
> vul.define_table('object_versions', migrate=False)
> vul.define_table('object_correlations', migrate=False)
> vul.define_table('object_affect_types', migrate=False)
> vul.define_table('object_links', migrate=False)
> vul.define_table('vulnerabilities', migrate=False)
> vul.define_table('credits', migrate=False)
> vul.define_table('authors', migrate=False)
> vul.define_table('ext_reference_types', migrate=False)
> vul.define_table('ext_references', migrate=False)
> vul.define_table('classification_types', migrate=False)
> vul.define_table('classification_items', migrate=False)
> vul.define_table('classifications', migrate=False)

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@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.

Reply via email to