I solved this.

On Friday, December 14, 2012 3:37:45 PM UTC-8, Lewis wrote:
>
> I understand that code and put it in my controller.
>
> But, where do I put the reference to it in the view (the base view that is 
> extended):
>
> By default it says:  <div id="navbar">{{='auth' in globals() and 
> auth.navbar(separators=(' ',' | ',''))}}</div>
>
> I assume that user.bar must replace auth.navbar(...).
>
> But, I don't see how.  An arbitrary function in a controller cannot do the 
> same things that the auth class method does.  The other problem is that my 
> user.bar() is not in default so I must also reference the controller file. 
>  Using URL('...', '....') in place of auth.navbar did not work.
>
> I am sorry:  when you go mucking about substituting for internal 
> functions/classes of web2py it is very unclear what one must do because the 
> behavior of the internal classes is a bit obscure.
>
> Thank you.
>
> On Friday, July 20, 2012 4:29:37 PM UTC-7, pbreit wrote:
>>
>> I just write my own:
>>
>> def user_bar():
>>     action = '/user'
>>     if auth.user:
>>         logout=A('logout', _href=action+'/logout')
>>         profile=A('profile', _href=action+'/profile')
>>         password=A('change password', _href=action+'/change_password')
>>         bar = SPAN(auth.user.email, ' | ', profile, ' | ', password, ' | 
>> ', logout, _class='auth_navbar')
>>     else:
>>         login=A('login', _href=action+'/login')
>>         register=A('register',_href=action+'/register')
>>         lost_password=A('lost password', _href=action+
>> '/request_reset_password')
>>         bar = SPAN(' ', login, ' | ', register, ' | ', lost_password,_class
>> ='auth_navbar')
>>     return bar
>>
>>

-- 



Reply via email to