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

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Mar 17 10:28:16 CET 2008


Author: jp
Date: Mon Mar 17 10:28:16 2008
New Revision: 19953

URL: http://svn.erp5.org?rev=19953&view=rev
Log:
Added layout property getter with explicit 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=19953&r1=19952&r2=19953&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/WebSection.py (original)
+++ erp5/trunk/products/ERP5/Document/WebSection.py Mon Mar 17 10:28:16 2008
@@ -116,6 +116,19 @@
               request.set(web_param, False)
 
       return PermanentURLMixIn.__bobo_traverse__(self, request, name)
+
+    security.declareProtected(Permissions.AccessContentsInformation, 'getLayoutProperty')
+    def getLayoutProperty(self, default):
+      """
+        A simple method to get a property of the current by 
+        acquiring it from the current section or its parents
+      """
+      section = aq_inner(self)
+      while section.getPortalType() in ('Web Section', 'Web Site'):
+        result = section.getProperty(default)
+        if result:
+          return result
+        section = section.aq_parent
 
     security.declareProtected(Permissions.AccessContentsInformation, 'getWebSectionValue')
     def getWebSectionValue(self):




More information about the Erp5-report mailing list