From 87f85c3546ea46de0e648983a11aded34c59d1a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20G=C3=B3rny?= <bartek@gorny.edu.pl> Date: Sun, 5 Nov 2006 07:55:50 +0000 Subject: [PATCH] Moved getWebSectionValue to Base until issue related to acquisition is understood git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11092 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/WebSection.py | 17 +++++++++++------ product/ERP5Type/Base.py | 14 ++++++++++++++ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/product/ERP5/Document/WebSection.py b/product/ERP5/Document/WebSection.py index 192c9bf892..9616b7b2e4 100644 --- a/product/ERP5/Document/WebSection.py +++ b/product/ERP5/Document/WebSection.py @@ -62,10 +62,15 @@ class WebSection(Domain): ) # Draft - this is being worked on - security.declareProtected(Permissions.AccessContentsInformation, 'getWebSectionValue') - def getWebSectionValue(self): - """ - Returns the current web section (ie. self) though containment acquisition - """ - return self + # Due to some issues in acquisition, the implementation of getWebSectionValue + # through acquisition by containment does not work for URLs + # such as web_site_module/a/b/c/web_page_module/d + # getWebSectionValue will return web_site_module/a/b instead + # of web_site_module/a/b/c + #security.declareProtected(Permissions.AccessContentsInformation, 'getWebSectionValue') + #def getWebSectionValue(self): + #""" + #Returns the current web section (ie. self) though containment acquisition + #""" + #return self diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py index b89eb3ec6e..780140ff1c 100644 --- a/product/ERP5Type/Base.py +++ b/product/ERP5Type/Base.py @@ -2706,6 +2706,20 @@ class Base( CopyContainer, dochelper.setDynamicPropertyList(dynamic_property_list) return dochelper + security.declareProtected(Permissions.AccessContentsInformation, 'getWebSectionValue') + def getWebSectionValue(self): + """ + Returns the current web section (ie. self) though parent acquisition + This method has been moved temporatily from WebSection to Base + until we understand the bug / issue in acquisition + """ + section = self + portal = self.getPortalObject() + while section.getPortalType() not in ('Web Site', 'Web Section', ) and\ + section is not portal: + section = section.aq_parent + return section + InitializeClass(Base) class TempBase(Base): -- 2.30.9