Jim Steil schrieb:
>  Hi
> 
> I'm trying to do the following in my html but am getting an error saying:
> 
> UndefinedError:<turbogears.identity.IdentityWrapper object at
> 0x01C4E970>  has no member named "has_permission"
> 
> 
> The HTML in question is:
> 
> <span py:if="not tg.identity.has_permission('customerUpdate')">
>     ${values.customerTypeName}
> </span>

The "tg.identity" object available in templates is *not* the module
object 'turbogears.identity". As you can see from the error message, it
is an instance of 'turbogears.identity.IdentityWrapper', which delegates
attribute access to the current identity object. The latter is normally
either an instance of 'SqlObjectIdentity' or 'SqlAlchemyIdentity',
depending on which identity provider you have configured. Neither of
which has an 'has_permission' method, hence the error.

What you want is:

    py:if="not 'customerUpdate' in tg.identity.permissions"

http://docs.turbogears.org/1.0/UsingIdentity#using-identity-in-templates


Chris

-- 
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