[Zope-dev] ZCatalog getObject broken
Chris Withers
chris at simplistix.co.uk
Thu Mar 3 09:56:03 EST 2005
Roché Compaan wrote:
> + obj = self.aq_parent.unrestrictedTraverse(self.getPath(), None)
> + if obj and securityManager.validate(obj, obj, None, None):
> + return obj
> + else:
> + return None
Urm, Roche, doesn't the above seek to do exactly what...
return self.aq_parent.restrictedTraverse(self.getPath(), None)
...does?
The problem is that an error should be raised, Unauthorized in my
opinion, rather than None being returned.
None should never be returned in place of a brain, although I'll soften
that to say that if it does, it means something weird has happened (used
to mean the object the catalog entry mapped to had gone away)
I think:
self.aq_parent.restrictedTraverse(self.getPath())
...should be fine, no?
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the Zope-Dev
mailing list