[z3-five] Re: SVN: Products.Five/trunk/browser/pagetemplatefile.py
fixed traverser
Florent Guillaume
fg at nuxeo.com
Fri Mar 3 16:09:55 CET 2006
I'm sorry if I appear harsh, I don't want that, especially as I'm not coding
much for Five these days, but...
How can you refactor the traverser (and in the trunk, not a branch) without
unit tests?
Florent
Andreas Jung wrote:
> Log message for revision 65681:
>
> fixed traverser
>
>
> Changed:
> U Products.Five/trunk/browser/pagetemplatefile.py
>
> -=-
> Modified: Products.Five/trunk/browser/pagetemplatefile.py
> ===================================================================
> --- Products.Five/trunk/browser/pagetemplatefile.py 2006-03-01 21:00:33 UTC (rev 65680)
> +++ Products.Five/trunk/browser/pagetemplatefile.py 2006-03-01 21:13:20 UTC (rev 65681)
> @@ -42,15 +42,15 @@
> next = getattr(object, name, _marker)
> if next is not _marker:
> object = next
> - elif hasattr(object, '__getitem__'):
> + else:
> try:
> - object = object[name]
> - except KeyError:
> - # deal with traversal through bobo_traverse()
> object = object.restrictedTraverse(name)
> - else:
> - # Allow AttributeError to propagate
> - object = getattr(object, name)
> + except (KeyError, AttributeError):
> + try:
> + object = object[name]
> + except:
> + object = getattr(object, name)
> +
> return object
>
>
>
> _______________________________________________
> Zope-Checkins maillist - Zope-Checkins at zope.org
> http://mail.zope.org/mailman/listinfo/zope-checkins
>
--
Florent Guillaume, Nuxeo (Paris, France) Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg at nuxeo.com
More information about the z3-five
mailing list