I have two different objects for Auth
autha = Auth(....)
authb = Auth(....)

Can we have multiple instances of Auth, if no then why not?

On May 24, 4:03 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Can you post the entire code that gives the problem?
>
> Do you have both authc and autht? There should be only one auth.
>
> When delete a database make sure also delete everything in app/
> databases/
>
> Massimo
>
> On May 23, 5:15 pm, Hasanat Kazmi <hasanatka...@gmail.com> wrote:
>
> > Now, I have changed database, I have switched to mysql, and whole
> > database is empty. Now it gives me this error:
> > Table 'web2py.teacher' doesn't exist
> > If create table myself, it says it already exists. Any help?
>
> > On May 23, 11:49 pm, Hasanat Kazmi <hasanatka...@gmail.com> wrote:
>
> > > Hi,
> > > I am newbie to web2py. I am working on a project where multiple people
> > > will have to get different type of authentication, (e.g. teacher and
> > > student have different level of access to the system). Now the problem
> > > is that I can not create different instances of Auth class, e.g.
>
> > > autht = Auth(globals(), db)
> > > autht.settings.table_user = db.define_table('teacher',
> > >     db.Field('first_name'),
> > >     db.Field('middlename'),
> > >     db.Field('last_name'),
> > >     db.Field('specialization'),
> > >     db.Field('highestdegre'),
> > >     db.Field('housenum'),
> > >     db.Field('streetnum'),
> > >     db.Field('area'),
> > >     db.Field('city'),
> > >     db.Field('country'),
> > >     db.Field('phone'),
> > >     db.Field('email',
> > >         requires = [IS_EMAIL(),
> > >                     IS_NOT_IN_DB(db,'teacher.email')]),
> > >     db.Field('username'),
> > >     db.Field('password', 'password', readable=False, requires=CRYPT
> > > ()),
> > >     db.Field('registration_key', length = 128, writable = False,
> > > readable = False, default = ''),
> > >     db.Field('createdon', 'date' , default = now),
> > >     #db.Field('controller', db.controller)
> > > )
> > > autht.define_tables()
>
> > > work seamlessly well but when I create another one, no matter which
> > > one is defined first it throws error, e.g I created following:
>
> > > authc = Auth(globals(), db)
> > > authc.settings.table_user = db.define_table('controller',
> > >     db.Field('first_name'),
> > >     db.Field('middlename'),
> > >     db.Field('last_name'),
> > >     db.Field('phone'),
> > >     db.Field('email',
> > >         requires = [IS_EMAIL(),
> > >                     IS_NOT_IN_DB(db,'teacher.email')]),
> > >     db.Field('username'),
> > >     db.Field('password', 'password', readable=False, requires=CRYPT
> > > ()),
> > >     db.Field('registration_key', length = 128, writable = False,
> > > readable = False, default = ''),
> > >     db.Field('createdon', 'date' , default = now)
> > > )
> > > authc.define_tables()
>
> > > this gives me following error:
>
> > > ProgrammingError: (1146, "Table 'web2py.controller' doesn't exist")
>
> > > does this error mean that web2py didnt find controller table in db,
> > > isnt it supposed to make it itself?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to