You are trying to solve the problem in the wrong way. You just need to tell 
auth where the user action is.

auth assumes:

auth = Auth(db, controller='default')

you need to change this if you move "def user(): ..." in a different 
controller. Then {{=auth.navbar()}} will work.

On Friday, 14 December 2012 18:28:51 UTC-6, Lewis wrote:
>
> It seemed a good idea to break up a large controller file into two.  Now I 
> have default.py and full.py.
> User() is in full.py.  So, now my views are broken because auth won't work 
> to create the auth links in the navbar.
>
> The default views reference auth as:  <div id="navbar">{{='auth' in 
> globals() and auth.navbar(separators=(' ',' | ',''))}}</div>
>
> I followed the suggestion to create my own auth.navbar as follows:  
>
> def user():
>     return dict(form = auth())
>
>
> def user_bar():
>     action = 'full/user'
>     if auth.user:
>         logout = A('logout', URL(action + '/logout'))
>         profile = A('profile', URL(action + '/profile'))
>         password = A('change password', URL(action + '/change_password'))
>         bar = SPAN(auth.user.email, ' | ', profile, ' | ', password, ' | 
> ', logout, _class = 'auth_navbar')
>     else:
>         login = A('login', URL(action + '/login'))
>         register = A('register', _href = action + '/register')
>         lost_password = A('lost password', URL(action + 
> '/request_reset_password'))
>         bar = SPAN(' ', login, ' | ', register, ' | ', lost_password, 
> _class = 'auth_navbar')
>     return bar
>
> So, in my views I need something like:
>
> <div id="navbar">{{=user_bar()}}</div>
>
> But, this produces the error:  
> <type 'exceptions.NameError'> name 'user_bar' is not defined
>
> I am really lost here, guys.  I don't understand what I am supposed to do 
> if the action isnot in default.py (which I don't want to do for other 
> reasons....).
>
>

-- 



Reply via email to