[Erp5-report] r9559 - /erp5/trunk/products/ERP5Type/Base.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Aug 30 16:15:09 CEST 2006
Author: kevin
Date: Wed Aug 30 16:15:06 2006
New Revision: 9559
URL: http://svn.erp5.org?rev=9559&view=rev
Log:
Override PortalContent __call__ method to adapt behaviour for content called within a web site.
Modified:
erp5/trunk/products/ERP5Type/Base.py
Modified: erp5/trunk/products/ERP5Type/Base.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Base.py?rev=9559&r1=9558&r2=9559&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py (original)
+++ erp5/trunk/products/ERP5Type/Base.py Wed Aug 30 16:15:06 2006
@@ -326,6 +326,7 @@
method = WorkflowMethod(method, method_id)
setattr(prop_holder, method_id, method)
+
class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
"""
This is the base class for all ERP5 Zope objects.
@@ -381,6 +382,21 @@
# We want to use a default property view
manage_propertiesForm = DTMLFile( 'dtml/properties', _dtmldir )
+
+ def __call__(self):
+ """
+ This method override PortalContent.__call__() method to get an altenate
+ default view if we have Web Site in the acquisition path.
+ If object is called within a Web Site object, try to use 'web_view' action
+ as default view. Else, use the default 'view' action as returned by the
+ default __call__ method of Portal Content objects.
+ """
+ rq = self.REQUEST
+ if hasattr(rq, 'web_site_value') and not (hasattr(rq, 'ignore_layout') or hasattr(rq, 'editable_mode')):
+ return _getViewFor(self, view='web_view')()
+ else:
+ call_method = getattr(PortalContent, '__call__', None)
+ return call_method(self)
security.declareProtected( Permissions.ModifyPortalContent, 'setTitle' )
def setTitle(self, value):
More information about the Erp5-report
mailing list