[Erp5-report] r22294 - in /erp5/trunk/products/ERP5: Document/ PropertySheet/
nobody at svn.erp5.org
nobody at svn.erp5.org
Sun Jul 6 16:13:49 CEST 2008
Author: jp
Date: Sun Jul 6 16:13:48 2008
New Revision: 22294
URL: http://svn.erp5.org?rev=22294&view=rev
Log:
Added a propertysheet so that the display of default page in a section can be turned off. This is useful for example to define translatable content through web pages in relation with a web section, although the web section should display a list of items. (ex. news, press, products in a shop, etc.)
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=22294&r1=22293&r2=22294&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/WebSection.py (original)
+++ erp5/trunk/products/ERP5/Document/WebSection.py Sun Jul 6 16:13:48 2008
@@ -175,22 +175,23 @@
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 None:
- # no document found for current user, still such document may exists
- # in some cases user (like Anonymous) can not view document according to portal catalog
- # but we may ask him to login if such a document exists
- isAuthorizationForced = getattr(self, 'isAuthorizationForced', None)
- if isAuthorizationForced is not None and isAuthorizationForced():
- getDefaultDocumentValue = UnrestrictedMethod(self.getDefaultDocumentValue)
- if getDefaultDocumentValue() is not None:
- # force user to login as specified in Web Section
- raise Unauthorized
- if document is not None:
- 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)()
+ if self.isDefaultPageDisplayed():
+ # The following could be moved to a typed based method for more flexibility
+ document = self.getDefaultDocumentValue()
+ if document is None:
+ # no document found for current user, still such document may exists
+ # in some cases user (like Anonymous) can not view document according to portal catalog
+ # but we may ask him to login if such a document exists
+ isAuthorizationForced = getattr(self, 'isAuthorizationForced', None)
+ if isAuthorizationForced is not None and isAuthorizationForced():
+ getDefaultDocumentValue = UnrestrictedMethod(self.getDefaultDocumentValue)
+ if getDefaultDocumentValue() is not None:
+ # force user to login as specified in Web Section
+ raise Unauthorized
+ if document is not None:
+ 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)
# Layout Selection API
@@ -222,8 +223,6 @@
result = self._getTypeBasedMethod('getDefaultDocumentValue',
fallback_script_id='WebSection_getDefaultDocumentValue')()
- if result is not None:
- result = result.__of__(self)
if cache is not None:
cache[key] = result
@@ -253,8 +252,6 @@
result = self._getTypeBasedMethod('getDocumentValueList',
fallback_script_id='WebSection_getDocumentValueList')(**kw)
- if result is not None:
- result = [doc.__of__(self) for doc in result]
if cache is not None:
cache[key] = result
Modified: erp5/trunk/products/ERP5/PropertySheet/WebSection.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/PropertySheet/WebSection.py?rev=22294&r1=22293&r2=22294&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/PropertySheet/WebSection.py (original)
+++ erp5/trunk/products/ERP5/PropertySheet/WebSection.py Sun Jul 6 16:13:48 2008
@@ -57,6 +57,11 @@
'description' : 'Defines visibility of current section.',
'type' : 'boolean',
'mode' : 'rw' },
+ { 'id' : 'default_page_displayed',
+ 'description' : 'Defines whether the default page should be displayed.',
+ 'type' : 'boolean',
+ 'default' : 1,
+ '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',
@@ -74,10 +79,10 @@
'acquisition_accessor_id' : 'getLayoutConfigurationFormId',
'acquisition_depends' : None,
'mode' : '' },
- { 'id' : 'authorization_forced',
+ { 'id' : 'authorization_forced',
'description' : 'Force authorization for anonymous user if document can not be found.',
'type' : 'boolean',
- 'default': 0,
+ 'default' : 0,
'mode' : 'rw' },
)
More information about the Erp5-report
mailing list