Commit 77b2bc44 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Jérome Perrin

ERP5Type: use Getter base accessor class as Tester's super class.

so that Tester methods will have some __roles__ as Getter.
parent c084b35b
......@@ -31,7 +31,7 @@ from AccessControl import ClassSecurityInfo
from AccessControl.SecurityManagement import getSecurityManager,\
setSecurityManager, newSecurityManager
from AccessControl.ZopeGuards import guarded_getattr
from MethodObject import Method
from Products.ERP5Type.Accessor.Base import Getter
from Products.ERP5Type.Globals import InitializeClass, DTMLFile
from zLOG import LOG, PROBLEM
......@@ -54,7 +54,7 @@ class Priority:
class func_code: pass
class PreferenceMethod(Method):
class PreferenceMethod(Getter):
""" A method object that lookup the attribute on preferences. """
# This is required to call the method form the Web
__code__ = func_code = func_code()
......
......@@ -203,19 +203,10 @@ class Getter(Method):
return getattr(roles, '__of__', lambda aq_parent: roles)(self)
class Tester(Method):
class Tester(Getter):
"""
Tests if an attribute value exists
"""
_need__name__=1
# Generic Definition of Method Object
# This is required to call the method form the Web
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, storage_id=None):
self._id = id
self.__name__ = id
......
......@@ -208,7 +208,7 @@ class ListGetter(Base.Getter):
DefaultGetter = Getter
class Tester(Method):
class Tester(Base.Tester):
"""
Tests if an attribute value exists
"""
......
......@@ -267,7 +267,7 @@ class ListGetter(Base.Getter):
DefaultGetter = Getter
class Tester(Method):
class Tester(Base.Tester):
"""
Tests if an attribute value exists
"""
......
......@@ -31,7 +31,7 @@ from zLOG import LOG
from Products.ERP5Type.PsycoWrapper import psyco
from Acquisition import aq_base
from Products.ERP5Type.Accessor.Base import func_code, ATTRIBUTE_PREFIX, evaluateTales, Getter as BaseGetter, Method
from Products.ERP5Type.Accessor.Base import func_code, ATTRIBUTE_PREFIX, evaluateTales, Getter as BaseGetter, Setter as BaseSetter, Tester as BaseTester
from Products.ERP5Type.Accessor import Accessor, AcquiredProperty
from Products.ERP5Type.Accessor.TypeDefinition import type_definition
from Products.ERP5Type.Utils import unicode2str
......@@ -218,7 +218,7 @@ class AcquiredPropertyGetter(AcquiredProperty.Getter):
else:
return default
class TranslatedPropertyTester(Method):
class TranslatedPropertyTester(BaseTester):
"""
Tests if an attribute value exists
"""
......
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