[Erp5-report] r19793 - in /erp5/trunk/products/ERP5/Document: Document.py WebSection.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Mar 11 15:02:06 CET 2008
Author: jp
Date: Tue Mar 11 15:02:05 2008
New Revision: 19793
URL: http://svn.erp5.org?rev=19793&view=rev
Log:
Make permanentURL system usable in standard ERP5.
Modified:
erp5/trunk/products/ERP5/Document/Document.py
erp5/trunk/products/ERP5/Document/WebSection.py
Modified: erp5/trunk/products/ERP5/Document/Document.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Document.py?rev=19793&r1=19792&r2=19793&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Document.py (original)
+++ erp5/trunk/products/ERP5/Document/Document.py Tue Mar 11 15:02:05 2008
@@ -231,6 +231,9 @@
that documents displayed outside a Web Site / Web Section
can also use the permanent URL principle.
"""
+
+ # Declarative security
+ security = ClassSecurityInfo()
### Extensible content
def _getExtensibleContent(self, request, name):
@@ -289,6 +292,44 @@
editable_absolute_url=document.absolute_url()))
return document.__of__(self)
+ security.declareProtected(Permissions.View, 'getDocumentValue')
+ def getDocumentValue(self, name=None, portal=None, **kw):
+ """
+ Return the default document with the given
+ name. The name parameter may represent anything
+ such as a document reference, an identifier,
+ etc.
+
+ If name is not provided, the method defaults
+ to returning the default document by calling
+ getDefaultDocumentValue.
+
+ kw parameters can be useful to filter content
+ (ex. force a given validation state)
+
+ This method must be implemented through a
+ portal type dependent script:
+ WebSection_getDocumentValue
+ """
+ if name is None:
+ return self.getDefaultDocumentValue()
+
+ cache = getReadOnlyTransactionCache(self)
+ method = None
+ if cache is not None:
+ key = ('getDocumentValue', self)
+ try:
+ method = cache[key]
+ except KeyError:
+ pass
+
+ if method is None: method = self._getTypeBasedMethod('getDocumentValue',
+ fallback_script_id='WebSection_getDocumentValue')
+
+ if cache is not None:
+ if cache.get(key, _MARKER) is _MARKER: cache[key] = method
+
+ return method(name, portal=portal, **kw)
class Document(PermanentURLMixIn, XMLObject, UrlMixIn, ConversionCacheMixin, SnapshotMixin):
"""
Modified: erp5/trunk/products/ERP5/Document/WebSection.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/WebSection.py?rev=19793&r1=19792&r2=19793&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/WebSection.py (original)
+++ erp5/trunk/products/ERP5/Document/WebSection.py Tue Mar 11 15:02:05 2008
@@ -175,45 +175,6 @@
return self.getContainerLayout()
# WebSection API
- security.declareProtected(Permissions.View, 'getDocumentValue')
- def getDocumentValue(self, name=None, portal=None, **kw):
- """
- Return the default document with the given
- name. The name parameter may represent anything
- such as a document reference, an identifier,
- etc.
-
- If name is not provided, the method defaults
- to returning the default document by calling
- getDefaultDocumentValue.
-
- kw parameters can be useful to filter content
- (ex. force a given validation state)
-
- This method must be implemented through a
- portal type dependent script:
- WebSection_getDocumentValue
- """
- if name is None:
- return self.getDefaultDocumentValue()
-
- cache = getReadOnlyTransactionCache(self)
- method = None
- if cache is not None:
- key = ('getDocumentValue', self)
- try:
- method = cache[key]
- except KeyError:
- pass
-
- if method is None: method = self._getTypeBasedMethod('getDocumentValue',
- fallback_script_id='WebSection_getDocumentValue')
-
- if cache is not None:
- if cache.get(key, MARKER) is MARKER: cache[key] = method
-
- return method(name, portal=portal, **kw)
-
security.declareProtected(Permissions.View, 'getDefaultDocumentValue')
def getDefaultDocumentValue(self):
"""
More information about the Erp5-report
mailing list