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:29:55PM -0400, Chris McDonough wrote: | > Before the changes, exceptions on __bobo_traverse__ would not be | > handled, so if a AttributeError would happen, it would pop up | > untouched, resulting on a 500 response status, instead of 404. | | Why is that a good thing? Shouldn't it be up to the implementor to | decide what should happen during bobo traverse? If an exception happens | that raises AttributeError or KeyError during __bt__, I don't think I | want it to try something else. I suppose you are referring to the stuff below here. As for converting into a NotFoundError, Tres suggested to do it in ZPublisher, and AttributeErrors not coming from __bobo_traverse__ are converted to NotFound already. | > It would also try __bobo_traverse__ only, if __bobo_traverse__ exists, | > completely ignoring __getattr__ and __getitem__. | | What makes it desirable to use __getattr__ and/or __getitem__ if the | object has a __bobo_traverse__? Simplifying __bobo_traverse__ implementation? | > After my change, AttributeError and KeyError in __bobo_traverse__ | > will be converted to a NotFound, resulting in a 404 response status. | | This seems like a bit more DWIM that would need to be carefully | undocumented, like all the other DWIM. ;-) 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. | > It will also continue looking through __getattr__ and __getitem__, | > which is where the semantics really differ. I'm more worried about | > changing the semantincs because there are other places where | > __bobo_traverse__ is used, namely restrictedTravers on OFS.Traversable | > and PageTemplates.Expressions. | | I don't know if this is a win. It's probably not, that's why I'm asking :) | > This change would simplify the implementations of __bobo_traverse__, | > which would not have to worry about looking at __getattr__ and | > __getitem__ themselves, but I would like to know what people think | > first. | | I'm -1, FWIW. Thanks! -- Sidnei da Silva <[email protected]> http://awkly.org - dreamcatching :: making your dreams come true http://www.enfoldsystems.com http://plone.org/about/team#dreamcatcher <KevinMarks> 'Our series A round is to help us build out the Other Plane; look at the returns possible once we transcend the mortal universe'