Commit 6a6b2010 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Make sure that documents obtained by getDefaultDocumentValue, getDocumentValue...

Make sure that documents obtained by getDefaultDocumentValue, getDocumentValue and getDocumentValueList are wrapped with self.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22293 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 47c2617d
...@@ -362,12 +362,18 @@ class PermanentURLMixIn(ExtensibleTraversableMixIn): ...@@ -362,12 +362,18 @@ class PermanentURLMixIn(ExtensibleTraversableMixIn):
except KeyError: except KeyError:
pass pass
if method is None: method = self._getTypeBasedMethod('getDocumentValue', if method is None:
fallback_script_id='WebSection_getDocumentValue') method = self._getTypeBasedMethod('getDocumentValue',
fallback_script_id='WebSection_getDocumentValue')
if cache is not None: if cache is not None:
if cache.get(key, _MARKER) is _MARKER: cache[key] = method if cache.get(key, _MARKER) is _MARKER:
return method(name, portal=portal, **kw) 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): class Document(PermanentURLMixIn, XMLObject, UrlMixIn, ConversionCacheMixin, SnapshotMixin):
""" """
......
...@@ -222,6 +222,8 @@ class WebSection(Domain, PermanentURLMixIn): ...@@ -222,6 +222,8 @@ class WebSection(Domain, PermanentURLMixIn):
result = self._getTypeBasedMethod('getDefaultDocumentValue', result = self._getTypeBasedMethod('getDefaultDocumentValue',
fallback_script_id='WebSection_getDefaultDocumentValue')() fallback_script_id='WebSection_getDefaultDocumentValue')()
if result is not None:
result = result.__of__(self)
if cache is not None: if cache is not None:
cache[key] = result cache[key] = result
...@@ -251,6 +253,8 @@ class WebSection(Domain, PermanentURLMixIn): ...@@ -251,6 +253,8 @@ class WebSection(Domain, PermanentURLMixIn):
result = self._getTypeBasedMethod('getDocumentValueList', result = self._getTypeBasedMethod('getDocumentValueList',
fallback_script_id='WebSection_getDocumentValueList')(**kw) fallback_script_id='WebSection_getDocumentValueList')(**kw)
if result is not None:
result = [doc.__of__(self) for doc in result]
if cache is not None: if cache is not None:
cache[key] = result cache[key] = result
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment