[Erp5-report] r22293 - in /erp5/trunk/products/ERP5/Document: Document.py WebSection.py

nobody at svn.erp5.org nobody at svn.erp5.org
Sun Jul 6 14:58:57 CEST 2008


Author: yo
Date: Sun Jul  6 14:58:56 2008
New Revision: 22293

URL: http://svn.erp5.org?rev=22293&view=rev
Log:
Make sure that documents obtained by getDefaultDocumentValue, getDocumentValue and getDocumentValueList are wrapped with self.

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=22293&r1=22292&r2=22293&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Document.py (original)
+++ erp5/trunk/products/ERP5/Document/Document.py Sun Jul  6 14:58:56 2008
@@ -362,12 +362,18 @@
       except KeyError:
         pass
 
-    if method is None: method = self._getTypeBasedMethod('getDocumentValue',
-                                      fallback_script_id='WebSection_getDocumentValue')
+    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)
+      if cache.get(key, _MARKER) is _MARKER:
+        cache[key] = method
+
+    document = method(name, portal=portal, **kw)
+    if document is not None:
+      document = document.__of__(self)
+    return document
 
 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=22293&r1=22292&r2=22293&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/WebSection.py (original)
+++ erp5/trunk/products/ERP5/Document/WebSection.py Sun Jul  6 14:58:56 2008
@@ -222,6 +222,8 @@
 
       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
@@ -251,6 +253,8 @@
 
       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




More information about the Erp5-report mailing list