What the "if 'auth' in globals():" for??

If you have it to make sure user it logged you can use the and/or tricks :

if auth.user and auth.has_membership('managers'):

If you remove it what happen?

Richard




On Mon, Nov 4, 2013 at 8:18 AM, Johann Spies <johann.sp...@gmail.com> wrote:

> The following configuration stopped working (I suspect with the upgrade to
> 2.7.4):
>
> I have this in auth_membership:
>
>
> 10 <https://crest2.sun.ac.za/nkb/appadmin/update/db/auth_membership/10>
> johann.spies 
> <https://crest2.sun.ac.za/nkb/appadmin/update/db/auth_user/2>managers
> (4) <https://crest2.sun.ac.za/nkb/appadmin/update/db/auth_group/4>
> And this in menu.py:
>
> if 'auth' in globals():
>     if auth.has_membership(role = 'managers'):
>         documentation_menu = [(T('Documentation'), False, None,
>                                [
>                                    # (T('ISI raw data'), False,
>                                    #  URL(request.application, 'static',
> 'isi-raw-data-doc.html'
>                                    #      , vars = dict(
> target="_blank"))),
>                                    (T('Documentation'),
>                                     False,
>                                     URL(request.application, 'static',
>
> 'documentation/build/html/index.html'))
>                                ],
>
>                            )
>                           ]
>         response.menu += documentation_menu
>
> This menu does not show up even if johann.spies is logged in.
>
> Why?
>
> Regards
> Johann
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to