Now I've changed a little, but it still doesn't work:

************************
from db.py

auth = Auth(globals(), db)

db.define_table(
    auth.settings.table_user_name,
    Field('username'),
    Field('password'))

auth.define_tables()

custom_auth_table = db[auth.settings.table_user_name] # get the
custom_auth_table
custom_auth_table.requires = IS_NOT_IN_DB(db,
custom_auth_table.username)



************************
from layout.html

{{if not custom_auth_table.username and not
request.function=='username':}}
{{=custom_auth_table.login (next=URL(r=request,args=args))}}
{{pass}}
{{include}}



************************


On Dec 15, 9:55 pm, Rick <[email protected]> wrote:
> Thanks for the advice. This code seems to work:
>
> ******************
> from gluon.settings import settings
> from gluon.tools import *
>
> # if running on Google App Engine
> if settings.web2py_runtime_gae:
>     from gluon.contrib.gql import *
>     # connect to Google BigTable
>     db = DAL('gae')
>     # and store sessions there
>     session.connect(request, response, db=db)
> else:
>     # if not, use SQLite or other DB
>         db = DAL("sqlite://db.db")
>
> db.define_table('todo',
>     Field('time'),
>     Field('thing'))
>
> auth = Auth(globals(), db)
>
> db.define_table(
>     auth.settings.table_user_name,
>     Field('name'),
>     Field('password'))
>
> auth.define_tables()
>
> custom_auth_table = db[auth.settings.table_user_name] # get the
> custom_auth_table
> ******************
>
> ...but now I try to write a kind of log in/out interface in views/
> layout.html. I don't know how it should look like in the case of
> custom auth. I tried with this that that gave an error mesage:
>
> {{if not auth.user and not request.function=='user':}}
> {{=atuh.login(next=URL(r=request,args=args))}}
> {{pass}}
>
> Any ideas?
>
> On Dec 15, 2:37 am, pbreit <[email protected]> wrote:
>
>
>
>
>
>
>
> > To customize auth, have a look 
> > at:http://web2py.com/book/default/chapter/08#Customizing-Auth
>
> > For one thing, the table definitely needs to be placed between auth =
> > Auth(globals(), db) and auth.define_tables()

Reply via email to