--- ECHO_content/ECHO_collection.py 2012/01/04 08:41:37 1.310.2.2 +++ ECHO_content/ECHO_collection.py 2012/01/16 18:57:50 1.310.2.3 @@ -1458,8 +1458,15 @@ class ECHO_collection(CatalogAware, Fold def showOverview(self): """overview""" - if 'ECHO_overview.html' in self.__dict__.keys(): - return getattr(self,'ECHO_overview.html')() + # use ECHO_overview.html template in this instance + if 'ECHO_overview.html' in self: + return self['ECHO_overview.html']() + + # use ECHO_overview_main template in path + if hasattr(self, 'ECHO_overview_main'): + return getattr(self, 'ECHO_overview_main')() + + # use template from Product pt=zptFile(self, 'zpt/ECHO_content_overview.zpt') return pt() @@ -1468,23 +1475,35 @@ class ECHO_collection(CatalogAware, Fold def index_html(self): """standard page""" if self.ZCacheable_isCachingEnabled(): - result = self.ZCacheable_get() if result is not None: # Got a cached value. return result - - if 'index.html' in self.__dict__.keys(): - ret=getattr(self,'index.html')() - - elif 'overview' in self.__dict__.keys(): + + # old Zope 2.9 method + #if 'index.html' in self.__dict__.keys(): + # ret=getattr(self,'index.html')() + + # use Zope 2.12 IContainer for child access + if 'index.html' in self: + # use index.html template if it exists + ret = self['index.html']() + + elif 'overview' in self: + # use red-rectangle template when there's an 'overview' ret=self.showOverview() + + # use getattr for acquisition elif hasattr(self,'collection_index_template'): - ret=self.collection_index_template() + # use 'collection_index_template' in acquisition path + ret=self.collection_index_template() + elif hasattr(self,'main_index_template'): - + # use 'main_index_template' in acquisition path ret=self.main_index_template.__of__(self)(self.main_template) + else: + # use template from Product pt=zptFile(self, 'zpt/ECHO_main_index_template_standard.zpt') pt.content_type="text/html" ret=pt.render()