Commit a8db841d authored by Jean-Paul Smets's avatar Jean-Paul Smets

Support for custom render.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15416 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 323fdc65
...@@ -247,9 +247,14 @@ class WebSection(Domain): ...@@ -247,9 +247,14 @@ class WebSection(Domain):
""" """
self.REQUEST.set('current_web_section', self) self.REQUEST.set('current_web_section', self)
if not self.REQUEST.get('editable_mode') and not self.REQUEST.get('ignore_layout'): if not self.REQUEST.get('editable_mode') and not self.REQUEST.get('ignore_layout'):
# Try to use a custom renderer if any
custom_render_method_id = self.getCustomRenderMethodId()
if custom_render_method_id is not None:
return getattr(self, custom_render_method_id)()
# The following could be moved to a typed based method for more flexibility
document = self.getDefaultDocumentValue() document = self.getDefaultDocumentValue()
if document is not None: if document is not None:
self.REQUEST.set('current_web_document', document) self.REQUEST.set('current_web_document', document.__of__(self)) # Used to be document
self.REQUEST.set('is_web_section_default_document', 1) self.REQUEST.set('is_web_section_default_document', 1)
return document.__of__(self)() return document.__of__(self)()
return Domain.__call__(self) return Domain.__call__(self)
......
...@@ -67,7 +67,13 @@ class WebSection: ...@@ -67,7 +67,13 @@ class WebSection:
{ 'id' : 'visible', { 'id' : 'visible',
'description' : 'Defines visibility of current section.', 'description' : 'Defines visibility of current section.',
'type' : 'boolean', 'type' : 'boolean',
'mode' : '' }, 'mode' : 'rw' },
{ 'id' : 'custom_render_method_id',
'description' : 'ID of a page template, script, form or any callable object'
'which overrides the default rendering of the section',
'type' : 'string',
'default' : None,
'mode' : 'rw' },
) )
_categories = ('aggregate', ) _categories = ('aggregate', )
......
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