First of all thanks a lot. I found out what my problem was. I was
defining what my obj_id was at the __init__ method when the right
thing is to do it at the evaluate method. That's why I kept getting
None as its value.

Rookie mistake. Problem solved.

On 12 mayo, 12:53, NiL <[email protected]> wrote:
> I've ran into some trouble with the predicates as well
>
> what is your exact version of repoze.what ?
> your user/group permission attribute, is a real attribute or a
> @property decorated method ?
>
> To find my content id in my predicate, I use something like :
>
> ...
> import re
> ID_RE = re.compile('\d+')
> ...
>
>     def evaluate(self, environ, credentials):
>         try:
>             current_user = environ['repoze.who.identity']['user']
>         except KeyError: # anonymous
>             self.unmet()
>         url = environ['pylons.routes_dict']['url']
>         obj_id = ID_RE.findall(url)[0]
>         context_object = self.klass.get(obj_id)
>         if context_object is None:
>             raise HTTPNotFound
>         if context_object.has_permission
>
> HTH
>
> NIL

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