[Zope-dev] Re: death to index_html; ObjectManager?

Toby Dickenson tdickenson@geminidataloggers.com
Wed, 17 Apr 2002 09:50:37 +0100


On Tuesday 16 Apr 2002 10:25 pm, Casey Duncan wrote:

>However, you should know that the crux of this change is really to the
>publisher, the mixin is just the management piece.

Hmmm. Thanks for raising this. I wasnt aware that these browser_default 
changes went so deep.

Im curious as to *why* they do. It looks like the requirements on the wiki 
could have been implemented by getting the management interface to add a 
smart index_html attribute that delegates to the real method.

> *any* object can
>define a browser_default hook that overrides 'index_html', not just
>objectmanagers.

Ive just checked through the implementation to see if you really mean *any* 
object..... and you do. The name browser_default is in the namespace 
accessible to PropertyManager (for properties) and ObjectManager (for 
sub-objects).  I guess this choice was deliberate, but I can see it being a 
problem for all those objects that are "objects" not "content".

I would be happier if this change to ZPublisher was conditional on something 
outside the through-the-web manageable namespace, and something which means 
it is turned off by default for legacy objects. Either an interface 
assertion, or something like:

*** lib/python/ZPublisher/BaseRequest.py        27 Mar 2002 21:51:05 -0000      
1.47
--- lib/python/ZPublisher/BaseRequest.py        17 Apr 2002 08:39:49 -0000
***************
*** 254,256 ****
                      entry_name = path.pop()
!                 elif hasattr(getattr(object, 'aq_base', object),
                               'browser_default'):
--- 254,258 ----
                      entry_name = path.pop()
!                 elif getattr(getattr(object, 'aq_base', object),
!                              '_implements_browser_default', 0) and \
!                      hasattr(getattr(object, 'aq_base', object),
                               'browser_default'):