[Erp5-report] r25567 - /erp5/trunk/products/ERP5/Document/WebSection.py

nobody at svn.erp5.org nobody at svn.erp5.org
Sat Feb 14 11:08:46 CET 2009


Author: jp
Date: Sat Feb 14 11:08:45 2009
New Revision: 25567

URL: http://svn.erp5.org?rev=25567&view=rev
Log:
Improved support of layout property acquisition.

Modified:
    erp5/trunk/products/ERP5/Document/WebSection.py

Modified: erp5/trunk/products/ERP5/Document/WebSection.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/WebSection.py?rev=25567&r1=25566&r2=25567&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/WebSection.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/WebSection.py [utf8] Sat Feb 14 11:08:45 2009
@@ -126,13 +126,16 @@
       """
       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):




More information about the Erp5-report mailing list