From 6236f60e68b13cb162be2512517aff399aee2fcb Mon Sep 17 00:00:00 2001 From: Jean-Paul Smets <jp@nexedi.com> Date: Sat, 14 Feb 2009 10:08:45 +0000 Subject: [PATCH] Improved support of layout property acquisition. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25567 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/WebSection.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/product/ERP5/Document/WebSection.py b/product/ERP5/Document/WebSection.py index 0448f6b76f..102bf47b1c 100644 --- a/product/ERP5/Document/WebSection.py +++ b/product/ERP5/Document/WebSection.py @@ -126,13 +126,16 @@ class WebSection(Domain, PermanentURLMixIn): """ section = aq_inner(self) while section.getPortalType() in ('Web Section', 'Web Site'): - if d is MARKER: - result = section.getProperty(key) - else: - result = section.getProperty(key, d) - if result: + result = section.getProperty(key, MARKER) + if result is not MARKER and result: return result section = section.aq_parent + # No property was defined on children neither on web site + # If a default is provided, return it + # else raise + if d is not MARKER: + return d + raise AttributeError('Web Section %s has no layout property %s' % (self.getUrl(), key)) security.declareProtected(Permissions.AccessContentsInformation, 'getWebSectionValue') def getWebSectionValue(self): -- 2.30.9