[Zope3-Users] How to allow one user to access only his object

Naotoshi Seo sonots at sonots.com
Fri Oct 21 20:24:02 EDT 2005


Sorry, this code did not make sense. This code trys to traverse 
'messageboardobject/messageobject/edit.html' also. I could access 
directly. I tried to reject only this by replacing else: to
elif string.find(name, 'editmine.html') == -1:
But, name value receives only 'messageobject' in this case, right? How 
can I reject only 'messageboardobject/messageobject/edit.html'
It looks there are smarter ways.

 >     def publishTraverse(self, request, name):
 >         if name == 'edit.html':
 >             subob = self._guessTraverse(request, name)
 >             if subob is not None:
 >                view = zapi.queryMultiAdapter((subob, request),
 >             name=name)
 >                if view is not None:
 >                    return view
 >             raise NotFound(subob, name, request)
 >
 >         else:
 >             subob = self.context.get(name, None)
 >             if subob is None:
 >                 view = zapi.queryMultiAdapter((self.context, request),
 >             name=name)
 >                 if view is not None:
 >                     return view
 >
 >                 raise NotFound(self.context, name, request)
 >
 >             return subob



More information about the Zope3-users mailing list