Hello

So I am really struggling with web2py user registration
I have a database that contains come required tables for webapp to work.
Now I want to create a user register form etc.
In db.py I added a create table
    #This is used to connect also to all other tables, SHOULD I CREATE A 
NEW CONNECTION FOR USER TABLES?????
    db = 
DAL('postgres://postgres:postgres@localhost/'+request.vars['school'], 
migrate=False)

    from gluon.tools import Auth
    auth = Auth(db, hmac_key=Auth.get_or_create_key())
    auth.define_tables()
    ## configure auth policy
    auth.settings.registration_requires_verification = False
    auth.settings.registration_requires_approval = False
    auth.settings.reset_password_requires_verification = True

And In my controler I have the following code in default.py 
def user():
    return dict(form=auth())

In view I have the following script 
{{='auth' in globals() and auth.navbar(separators=(' ',' | ',''))}}

I copied all this from web2py welcome app.

I get an error NameError: global name 'auth' is not defined 

Any suggestions? The tables for user are not created yet. Is a user 
function in a wrong controler, should I created a new one? Because If I do, 
then the wrong funciton is called and again I get an error.







-- 



Reply via email to