Re: Changes to ZPublisher
Sidnei da Silva <[email protected]>
| Newsgroups | gmane.comp.web.zope.coders |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Oct 06, 2004 at 12:54:14PM -0400, Chris McDonough wrote: | > I suppose you are referring to the stuff below here. | | It appears I misread this; you don't do getattr or getitem when you get | an AttributeError/KeyError from __bt__, that's good. I actually do right now, but I feel it's wrong. ZPublisher didn't do it before. If you say not doing it is good, then I'm surely removing it. | > The intention here is not introduce anything new, but to traversal | > using __bobo_traverse__ behave the same way as attribute traversal | > with regards to exceptions raised. | | I guess the difference is that the publisher is trying to catch | AttreibuteError/KeyError/TypeError/IndexError as a result of its own | operations to *get* the object. I don't think it was ever intended that | if you raise an AttributeError/KeyError from app code (implemented, in | this case, in __bt__) that it would have the side effect of causing a | NotFoundError. I know that's the effect of the current code, but I | really don't think that when the Publisher was implemented that this was | ever considered. The main reasoning for all of this was that: - __bt__ exceptions would pass by unmodified on ZPublisher - so we thought raising NotFound from __bt__ would be fine - but then it broke PageTemplates.Expressions (SubPathExpression) because it doesn't expect a NotFound - raising AttributeError copes well with PageTemplates.Expressions - but in the case of ZPublisher it should really be NotFound, as it is really coming from the browser, and not trying to find an attribute in application code - Tres said that NotFound should not be raised by application code, but only by ZPublisher. So, just to clarify, are you ok with converting the AttributeError/KeyError to NotFound on ZPublisher and not trying to fallback to __getattr__/__getitem__? -- Sidnei da Silva <[email protected]> http://awkly.org - dreamcatching :: making your dreams come true http://www.enfoldsystems.com http://plone.org/about/team#dreamcatcher I bet the human brain is a kludge. -- Marvin Minsky