Commit 979a07d5 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Fixed implementation of getLayoutProperty with default value

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20331 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ef98d3db
...@@ -118,14 +118,17 @@ class WebSection(Domain, PermanentURLMixIn): ...@@ -118,14 +118,17 @@ class WebSection(Domain, PermanentURLMixIn):
return PermanentURLMixIn.__bobo_traverse__(self, request, name) return PermanentURLMixIn.__bobo_traverse__(self, request, name)
security.declareProtected(Permissions.AccessContentsInformation, 'getLayoutProperty') security.declareProtected(Permissions.AccessContentsInformation, 'getLayoutProperty')
def getLayoutProperty(self, default): def getLayoutProperty(self, key, d=MARKER):
""" """
A simple method to get a property of the current by A simple method to get a property of the current by
acquiring it from the current section or its parents acquiring it from the current section or its parents
""" """
section = aq_inner(self) section = aq_inner(self)
while section.getPortalType() in ('Web Section', 'Web Site'): while section.getPortalType() in ('Web Section', 'Web Site'):
result = section.getProperty(default) if d is MARKER:
result = section.getProperty(key)
else:
result = section.getProperty(key, d)
if result: if result:
return result return result
section = section.aq_parent section = section.aq_parent
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment