Re: [Zope-dev] brain.getObject and traversal

2005-04-04 Thread Chris Withers
Florent Guillaume wrote: Is everyone ok with returning - the object if it can be accessed - raise Unauthorized if it can't be accessed - raise NotFound if it's not there Please don't catch any exceptions and re-raise them in a different type, just let them pass through. I specifically don't

Re: [Zope-dev] brain.getObject and traversal

2005-04-01 Thread Chris Withers
Florent Guillaume wrote: Well of course no, but I never had to check a getObject() against Unauthorized. Maybe it's because I only use it in a CMF setting where unaccessible objects are filtered anyway. Maybe, but CMF isn't the only use of Zope ;-) OTOH you're a bit excessive in your Whole

Re: [Zope-dev] brain.getObject and traversal

2005-04-01 Thread Florent Guillaume
Florent Guillaume [EMAIL PROTECTED] wrote: Unauthorized in getObject is out of the question, that would be new behaviour. Well, in 2.8, new behaviour is expected, right? I really passionately believe that we should not be returnining None in Zope 2.8, and since 2.8 hasn't quite hit

Re: [Zope-dev] brain.getObject and traversal

2005-04-01 Thread Dieter Maurer
Florent Guillaume wrote at 2005-4-1 13:21 +0200: Florent Guillaume [EMAIL PROTECTED] wrote: Unauthorized in getObject is out of the question, that would be new behaviour. Well, in 2.8, new behaviour is expected, right? I really passionately believe that we should not be returnining

Re: [Zope-dev] brain.getObject and traversal

2005-03-31 Thread Chris Withers
Florent Guillaume wrote: You're mistaken. The old code did: def getObject(self, REQUEST=None): Try to return the object for this record try: obj = self.aq_parent.unrestrictedTraverse(self.getPath()) if not obj: if REQUEST is None:

Re: [Zope-dev] brain.getObject and traversal

2005-03-31 Thread Roché Compaan
On Thu, 2005-03-31 at 13:02 +0100, Chris Withers wrote: Would anyone object if I wrote tests and changed the implementation to raise exceptions, including Unauthorized, instead of returning None? Unauthorized in getObject is out of the question, that would be new behaviour. Well,

Re: [Zope-dev] brain.getObject and traversal

2005-03-31 Thread Florent Guillaume
Chris Withers wrote: You're mistaken. The old code did: def getObject(self, REQUEST=None): Try to return the object for this record try: obj = self.aq_parent.unrestrictedTraverse(self.getPath()) if not obj: if REQUEST is None:

[Zope-dev] brain.getObject and traversal

2005-03-30 Thread Florent Guillaume
To try to clarify things even more: The implementation of getObject I checked in a few days ago has the following properties: 1. it checks permissions only on the last step of the traversal, 2. it returns None if for some reason the object cannot be retrieved. Now for the rationale: 1. is

Re: [Zope-dev] brain.getObject and traversal

2005-03-30 Thread Chris Withers
Florent Guillaume wrote: 2. is necessary for backward compatibility. *all* the previous implementations of getObject returned None in case of problems. This is the only bit I'm asking about, I accept that I'm in the insane minority on the other point ;-) Just because that's what it did before

Re: [Zope-dev] brain.getObject and traversal

2005-03-30 Thread Florent Guillaume
Chris Withers wrote: Just because that's what it did before doesn't mean we should leave it like that. I can see absolutely no benefit in returning None over raising a specific error. Also, the original behaviour of getObject, prior to Casey's drastic and unexpected switch to