From 92e13bbb5173c3dfe2c7894b3cabeec16e10d8c5 Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Tue, 7 Apr 2009 13:22:43 +0000 Subject: [PATCH] getWebSectionValueList should return nothing if no web section is visible. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26334 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/WebSite.py | 38 ++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/product/ERP5/Document/WebSite.py b/product/ERP5/Document/WebSite.py index 7bcce6ae18..a9b55dddd0 100644 --- a/product/ERP5/Document/WebSite.py +++ b/product/ERP5/Document/WebSite.py @@ -220,26 +220,30 @@ class WebSite(WebSection): id='WebSite._getWebSectionUidList', cache_factory='erp5_content_medium') - section_list = self.portal_domains.searchPredicateList(document, - portal_type='Web Section', - uid=_getWebSectionUidList(self)) + web_section_uid_list = _getWebSectionUidList(self) + if web_section_uid_list: + section_list = self.portal_domains.searchPredicateList(document, + portal_type='Web Section', + uid=web_section_uid_list) - section_dict = {} + section_dict = {} - for section in section_list: - section_dict[section.getPhysicalPath()] = section + for section in section_list: + section_dict[section.getPhysicalPath()] = section - # Eliminate path - for section in section_list: - path = section.getPhysicalPath() - for i in range(0, len(path)-1): - sub_path = path[0:i] - if section_dict.has_key(sub_path): - del section_dict[sub_path] + # Eliminate path + for section in section_list: + path = section.getPhysicalPath() + for i in range(0, len(path)-1): + sub_path = path[0:i] + if section_dict.has_key(sub_path): + del section_dict[sub_path] - section_list = section_dict.values() + section_list = section_dict.values() - # Sort by Index - section_list.sort(key=lambda x: x.getIntIndex()) + # Sort by Index + section_list.sort(key=lambda x: x.getIntIndex()) - return section_list + return section_list + else: + return [] -- 2.30.9