=?iso-8859-1?Q?Gr=E9goire?= Weber writes:
AttributeError / getPhysicalRoot has gone changing
index_obj = getattr(container.aq_base, 'index_html', None)
to
if hasattr(container.aq_base, 'index_html'): index_obj = getattr(container, 'index_html') else: index_obj = None
I thought they were equivalent -- they're not !!!
Can somebody confirm that (inclusive reasons)? I can.
"container.aq_base" is "container" without any acquisition context. "getattr(container.aq_base,attr)" is "attr" in the context of "container.aq_base". Further acquisition context is missing. "getattr(container,attr)" is "attr" in the context of "container". It has full acquisition context. If it is not clear, read the "Acquisition" section in <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html> and draw some acquisition trees. Dieter