Commit 0680a972 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Make sure that rounding proxies can work correctly with ListBox (XXX need to write a test).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35410 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent be65ee02
...@@ -29,7 +29,7 @@ from AccessControl import ClassSecurityInfo ...@@ -29,7 +29,7 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import PropertySheet, Permissions from Products.ERP5Type import PropertySheet, Permissions
from Products.ERP5.Document.Predicate import Predicate from Products.ERP5.Document.Predicate import Predicate
from Products.ERP5Type.Utils import UpperCase from Products.ERP5Type.Utils import UpperCase
import ExtensionClass
class RoundingModel(Predicate): class RoundingModel(Predicate):
""" """
...@@ -153,6 +153,11 @@ class RoundingModel(Predicate): ...@@ -153,6 +153,11 @@ class RoundingModel(Predicate):
else: else:
return result return result
# XXX not sure why but getObject may return original_document
# unless it is overridden here.
def getObject(self, *args, **kw):
return self
def __getattr__(self, name): def __getattr__(self, name):
attribute = getattr(original_document, name) attribute = getattr(original_document, name)
if getattr(attribute, 'DUMMY_ROUNDING_METHOD_MARK', None) is DUMMY_ROUNDING_METHOD_MARK: if getattr(attribute, 'DUMMY_ROUNDING_METHOD_MARK', None) is DUMMY_ROUNDING_METHOD_MARK:
...@@ -168,7 +173,9 @@ class RoundingModel(Predicate): ...@@ -168,7 +173,9 @@ class RoundingModel(Predicate):
DUMMY_ROUNDING_METHOD_MARK = object() DUMMY_ROUNDING_METHOD_MARK = object()
class RoundingProxy(object): # Use the Extension Class only because it is necessary to allow an instance
# of this class to be wrapped in an acquisition wrapper.
class RoundingProxy(ExtensionClass.Base):
"""Super class of _RoundingProxy class defined above. Use this class for """Super class of _RoundingProxy class defined above. Use this class for
isinstance method to check if object is a real instance or a rounding proxy isinstance method to check if object is a real instance or a rounding proxy
instance. instance.
......
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