[Erp5-report] r15416 - in /erp5/trunk/products/ERP5: Document/ PropertySheet/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Aug 2 14:03:16 CEST 2007


Author: jp
Date: Thu Aug  2 14:03:16 2007
New Revision: 15416

URL: http://svn.erp5.org?rev=15416&view=rev
Log:
Support for custom render.

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

Modified: erp5/trunk/products/ERP5/Document/WebSection.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/WebSection.py?rev=15416&r1=15415&r2=15416&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/WebSection.py (original)
+++ erp5/trunk/products/ERP5/Document/WebSection.py Thu Aug  2 14:03:16 2007
@@ -247,9 +247,14 @@
       """
       self.REQUEST.set('current_web_section', self)
       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()
         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)
           return document.__of__(self)()
       return Domain.__call__(self)

Modified: erp5/trunk/products/ERP5/PropertySheet/WebSection.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/PropertySheet/WebSection.py?rev=15416&r1=15415&r2=15416&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/PropertySheet/WebSection.py (original)
+++ erp5/trunk/products/ERP5/PropertySheet/WebSection.py Thu Aug  2 14:03:16 2007
@@ -67,7 +67,13 @@
         {   'id'          : 'visible',
             'description' : 'Defines visibility of current section.',
             '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', )




More information about the Erp5-report mailing list