You have a subtle problem in your code there, and it's easy to miss. Your
permissions in your template should always evaluate to true from what you've
shown. You need to do the following in your template:

<p py:if="tg.predicates.has_permission( page.permission ).is_met()">Has
full control</p>

Without that "is_met()" at the end, all calls will result in True, which is
very likely not what you want.

On Sat, Jul 24, 2010 at 7:23 AM, bloeper <[email protected]> wrote:

> Found the problem, needed to use page.permission.permission_name..
> Was a bit of a dumb mistake, but fixed now :)
>
> On Jul 23, 7:51 pm, bloeper <[email protected]> wrote:
> > I have found that i can use this in a template:
> > <p py:if="tg.predicates.has_permission( page.permission )">Has full
> > control</p>
> >
> > But the problem is, that it doesn't parse the var page.permission :S
> > When i do:
> > <p py:if="tg.predicates.has_permission( 'sec_page' )">Has full
> > control</p>
> > I get the Has full control line.
> > But when i use page.permission (which contains sec_page), it doesn't
> > work.
> > Anyone has an idea why this is happening?
> >
> > On Jul 23, 9:39 am, bloeper <[email protected]> wrote:
> >
> > > Ok but if that's the case, can you just do something like:
> > > identity.has_perm(perm_id); ?
> > > Or do I need some other stuff in there?
> >
> > > On Jul 22, 9:42 pm, NiL <[email protected]> wrote:
> >
> > > > just a pointer
> >
> > > > the user is known as identity in the template
> >
> > > > see lib/base.py
> >
> > > > or maybe list permissions in some helper ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<turbogears%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/turbogears?hl=en.
>
>


-- 
Michael J. Pedersen
My IM IDs: Jabber/[email protected], ICQ/103345809, AIM/pedermj022171
          Yahoo/pedermj2002, MSN/[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to