Commit 09cd5937 authored by Aurel's avatar Aurel

redefined accessors inheritance so that all getter inherit from

Base.Getter and all Setter inherit from Base.Setter, this will make
security check on accessors works for all


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21087 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 786b4b55
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
# #
############################################################################## ##############################################################################
from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Getter as BaseGetter
from Products.ERP5Type.PsycoWrapper import psyco from Products.ERP5Type.PsycoWrapper import psyco
class DefaultGetter(Method): class DefaultGetter(BaseGetter):
""" """
Gets the default reference of a relation Gets the default reference of a relation
""" """
...@@ -106,7 +106,7 @@ class DefaultGetter(Method): ...@@ -106,7 +106,7 @@ class DefaultGetter(Method):
Getter = DefaultGetter Getter = DefaultGetter
class ListGetter(Method): class ListGetter(BaseGetter):
""" """
Gets an attribute value Gets an attribute value
""" """
......
...@@ -28,11 +28,11 @@ ...@@ -28,11 +28,11 @@
import warnings import warnings
from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Getter as BaseGetter, Setter as BaseSetter
from Products.ERP5Type.PsycoWrapper import psyco from Products.ERP5Type.PsycoWrapper import psyco
from zLOG import LOG from zLOG import LOG
class Getter(Method): class Getter(BaseGetter):
""" """
Gets the default reference of a relation Gets the default reference of a relation
""" """
...@@ -108,7 +108,7 @@ class Getter(Method): ...@@ -108,7 +108,7 @@ class Getter(Method):
DefaultGetter = Getter DefaultGetter = Getter
class Setter(Method): class Setter(BaseSetter):
""" """
Sets a value of a property wich can be acquired. Sets a value of a property wich can be acquired.
Since we set here the property, we must not call acquisition. Since we set here the property, we must not call acquisition.
......
...@@ -26,12 +26,12 @@ ...@@ -26,12 +26,12 @@
# #
############################################################################## ##############################################################################
from Accessor import Accessor as Method from Base import Setter
# Creation of default constructor # Creation of default constructor
class func_code: pass class func_code: pass
class Reindex(Method): class Reindex(Setter):
""" """
Calls a given accessor and reindexes the object. Calls a given accessor and reindexes the object.
......
...@@ -28,11 +28,11 @@ ...@@ -28,11 +28,11 @@
import warnings import warnings
from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Setter as BaseSetter, Getter as BaseGetter
from zLOG import LOG from zLOG import LOG
from Products.ERP5Type.PsycoWrapper import psyco from Products.ERP5Type.PsycoWrapper import psyco
class ListSetter(Method): class ListSetter(BaseSetter):
""" """
Sets a category Sets a category
""" """
...@@ -68,7 +68,7 @@ class ListSetter(Method): ...@@ -68,7 +68,7 @@ class ListSetter(Method):
Setter = ListSetter Setter = ListSetter
class DefaultSetter(Method): class DefaultSetter(BaseSetter):
""" """
Sets a category Sets a category
""" """
...@@ -101,7 +101,7 @@ class DefaultSetter(Method): ...@@ -101,7 +101,7 @@ class DefaultSetter(Method):
instance.reindexObject() instance.reindexObject()
return (instance, ) return (instance, )
class SetSetter(Method): class SetSetter(BaseSetter):
""" """
Sets a set of category Sets a set of category
""" """
...@@ -147,7 +147,7 @@ class SetSetter(Method): ...@@ -147,7 +147,7 @@ class SetSetter(Method):
return (instance, ) return (instance, )
class DefaultGetter(Method): class DefaultGetter(BaseGetter):
""" """
Gets a default category value Gets a default category value
""" """
...@@ -178,7 +178,7 @@ class DefaultGetter(Method): ...@@ -178,7 +178,7 @@ class DefaultGetter(Method):
checked_permission=kw.get('checked_permission', None)) checked_permission=kw.get('checked_permission', None))
psyco.bind(__call__) psyco.bind(__call__)
class ListGetter(Method): class ListGetter(BaseGetter):
""" """
Gets a category value list Gets a category value list
""" """
...@@ -214,7 +214,7 @@ class SetGetter(ListGetter): ...@@ -214,7 +214,7 @@ class SetGetter(ListGetter):
# ItemList is outdated XXX -> ItemList # ItemList is outdated XXX -> ItemList
class ItemListGetter(Method): class ItemListGetter(BaseGetter):
""" """
Gets a category value list Gets a category value list
""" """
......
...@@ -37,7 +37,7 @@ DefaultValueSetter = Base.Setter ...@@ -37,7 +37,7 @@ DefaultValueSetter = Base.Setter
from zLOG import LOG from zLOG import LOG
class ValueGetter(Method): class ValueGetter(Base.Getter):
""" """
Gets an attribute value. A default value can be Gets an attribute value. A default value can be
provided if needed provided if needed
...@@ -87,7 +87,7 @@ class ValueGetter(Method): ...@@ -87,7 +87,7 @@ class ValueGetter(Method):
psyco.bind(__call__) psyco.bind(__call__)
class ValueListGetter(Method): class ValueListGetter(Base.Getter):
""" """
Gets an attribute value. A default value can be Gets an attribute value. A default value can be
provided if needed provided if needed
...@@ -123,7 +123,7 @@ class ValueListGetter(Method): ...@@ -123,7 +123,7 @@ class ValueListGetter(Method):
DefaultValueGetter = ValueGetter DefaultValueGetter = ValueGetter
class Getter(Method): class Getter(Base.Getter):
""" """
Gets an attribute value. A default value can be Gets an attribute value. A default value can be
provided if needed provided if needed
...@@ -169,7 +169,7 @@ class Getter(Method): ...@@ -169,7 +169,7 @@ class Getter(Method):
psyco.bind(__call__) psyco.bind(__call__)
class ListGetter(Method): class ListGetter(Base.Getter):
""" """
Gets an attribute value. A default value can be Gets an attribute value. A default value can be
provided if needed provided if needed
......
...@@ -39,7 +39,7 @@ DefaultValueSetter = Base.Setter ...@@ -39,7 +39,7 @@ DefaultValueSetter = Base.Setter
from zLOG import LOG from zLOG import LOG
class ValueGetter(Method): class ValueGetter(Base.Getter):
""" """
Gets an attribute value. A default value can be Gets an attribute value. A default value can be
provided if needed provided if needed
...@@ -87,7 +87,7 @@ class ValueGetter(Method): ...@@ -87,7 +87,7 @@ class ValueGetter(Method):
psyco.bind(__call__) psyco.bind(__call__)
class ValueListGetter(Method): class ValueListGetter(Base.Getter):
""" """
Gets an attribute value. A default value can be Gets an attribute value. A default value can be
provided if needed provided if needed
...@@ -126,7 +126,7 @@ class ValueListGetter(Method): ...@@ -126,7 +126,7 @@ class ValueListGetter(Method):
DefaultValueGetter = ValueGetter DefaultValueGetter = ValueGetter
class Getter(Method): class Getter(Base.Getter):
""" """
Gets an attribute value. A default value can be Gets an attribute value. A default value can be
provided if needed provided if needed
...@@ -173,7 +173,7 @@ class Getter(Method): ...@@ -173,7 +173,7 @@ class Getter(Method):
psyco.bind(__call__) psyco.bind(__call__)
class Setter(Method): class Setter(Base.Setter):
""" """
Gets an attribute value. A default value can be Gets an attribute value. A default value can be
provided if needed provided if needed
...@@ -237,7 +237,7 @@ class Setter(Method): ...@@ -237,7 +237,7 @@ class Setter(Method):
modified_object_list = (o, ) modified_object_list = (o, )
return modified_object_list return modified_object_list
class ListGetter(Method): class ListGetter(Base.Getter):
""" """
Gets an attribute value. A default value can be Gets an attribute value. A default value can be
provided if needed provided if needed
......
...@@ -38,7 +38,7 @@ from types import ListType, TupleType ...@@ -38,7 +38,7 @@ from types import ListType, TupleType
from zLOG import LOG from zLOG import LOG
class DefaultSetter(Method): class DefaultSetter(Base.Setter):
""" """
Sets the default attribute in a list Sets the default attribute in a list
""" """
...@@ -126,7 +126,7 @@ class ListSetter(DefaultSetter): ...@@ -126,7 +126,7 @@ class ListSetter(DefaultSetter):
Setter = ListSetter Setter = ListSetter
class SetSetter(Method): class SetSetter(Base.Setter):
""" """
Sets the default attribute in a list Sets the default attribute in a list
""" """
...@@ -198,7 +198,7 @@ class SetSetter(Method): ...@@ -198,7 +198,7 @@ class SetSetter(Method):
method(*args, **kw) method(*args, **kw)
instance.reindexObject() instance.reindexObject()
class DefaultGetter(Method): class DefaultGetter(Base.Getter):
""" """
Gets the first item of a list Gets the first item of a list
""" """
...@@ -250,7 +250,7 @@ class DefaultGetter(Method): ...@@ -250,7 +250,7 @@ class DefaultGetter(Method):
Getter = DefaultGetter Getter = DefaultGetter
class ListGetter(Method): class ListGetter(Base.Getter):
""" """
Gets an attribute value. A default value can be Gets an attribute value. A default value can be
provided if needed provided if needed
......
...@@ -26,13 +26,13 @@ ...@@ -26,13 +26,13 @@
# #
############################################################################## ##############################################################################
from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Getter as BaseGetter, Setter as BaseSetter
from Products.ERP5Type.PsycoWrapper import psyco from Products.ERP5Type.PsycoWrapper import psyco
from zLOG import LOG from zLOG import LOG
from zLOG import WARNING from zLOG import WARNING
class DefaultGetter(Method): class DefaultGetter(BaseGetter):
""" """
Gets a default reference object Gets a default reference object
""" """
...@@ -65,7 +65,7 @@ class DefaultGetter(Method): ...@@ -65,7 +65,7 @@ class DefaultGetter(Method):
Getter = DefaultGetter Getter = DefaultGetter
class ListGetter(Method): class ListGetter(BaseGetter):
""" """
Gets a list of reference objects Gets a list of reference objects
""" """
......
...@@ -27,12 +27,12 @@ ...@@ -27,12 +27,12 @@
############################################################################## ##############################################################################
from Base import func_code, type_definition, list_types, \ from Base import func_code, type_definition, list_types, \
ATTRIBUTE_PREFIX, Method ATTRIBUTE_PREFIX, Getter as BaseGetter, Setter as BaseSetter
from Products.ERP5Type.PsycoWrapper import psyco from Products.ERP5Type.PsycoWrapper import psyco
from zLOG import LOG from zLOG import LOG
from zLOG import WARNING from zLOG import WARNING
class DefaultGetter(Method): class DefaultGetter(BaseGetter):
""" """
Gets a default reference object Gets a default reference object
""" """
...@@ -72,7 +72,7 @@ class DefaultGetter(Method): ...@@ -72,7 +72,7 @@ class DefaultGetter(Method):
Getter = DefaultGetter Getter = DefaultGetter
class ListGetter(Method): class ListGetter(BaseGetter):
""" """
Gets a list of reference objects Gets a list of reference objects
""" """
...@@ -119,7 +119,7 @@ class SetGetter(ListGetter): ...@@ -119,7 +119,7 @@ class SetGetter(ListGetter):
result_set = dict([(x, 0) for x in result_list]).keys() result_set = dict([(x, 0) for x in result_list]).keys()
return result_set return result_set
class DefaultIdGetter(Method): class DefaultIdGetter(BaseGetter):
""" """
Gets a default reference object Gets a default reference object
""" """
...@@ -155,7 +155,7 @@ class DefaultIdGetter(Method): ...@@ -155,7 +155,7 @@ class DefaultIdGetter(Method):
IdGetter = DefaultIdGetter IdGetter = DefaultIdGetter
class IdListGetter(Method): class IdListGetter(BaseGetter):
""" """
Gets a list of reference objects Gets a list of reference objects
""" """
...@@ -198,7 +198,7 @@ class IdSetGetter(IdListGetter): ...@@ -198,7 +198,7 @@ class IdSetGetter(IdListGetter):
result_set = dict([(x, 0) for x in result_list]).keys() result_set = dict([(x, 0) for x in result_list]).keys()
return result_set return result_set
class DefaultTitleGetter(Method): class DefaultTitleGetter(BaseGetter):
""" """
Gets a default reference object Gets a default reference object
""" """
...@@ -234,7 +234,7 @@ class DefaultTitleGetter(Method): ...@@ -234,7 +234,7 @@ class DefaultTitleGetter(Method):
TitleGetter = DefaultTitleGetter TitleGetter = DefaultTitleGetter
class TitleListGetter(Method): class TitleListGetter(BaseGetter):
""" """
Gets a list of reference objects Gets a list of reference objects
""" """
...@@ -277,7 +277,7 @@ class TitleSetGetter(TitleListGetter): ...@@ -277,7 +277,7 @@ class TitleSetGetter(TitleListGetter):
result_set = dict([(x, 0) for x in result_list]).keys() result_set = dict([(x, 0) for x in result_list]).keys()
return result_set return result_set
class DefaultPropertyGetter(Method): class DefaultPropertyGetter(BaseGetter):
""" """
Gets a default reference object Gets a default reference object
""" """
...@@ -312,7 +312,7 @@ class DefaultPropertyGetter(Method): ...@@ -312,7 +312,7 @@ class DefaultPropertyGetter(Method):
PropertyGetter = DefaultPropertyGetter PropertyGetter = DefaultPropertyGetter
class PropertyListGetter(Method): class PropertyListGetter(BaseGetter):
""" """
Gets a list of reference objects Gets a list of reference objects
""" """
......
...@@ -26,13 +26,13 @@ ...@@ -26,13 +26,13 @@
# #
############################################################################## ##############################################################################
from Base import func_code, ATTRIBUTE_PREFIX, Method, evaluateTales from Base import func_code, ATTRIBUTE_PREFIX, evaluateTales, Getter as BaseGetter
from zLOG import LOG from zLOG import LOG
from Products.ERP5Type.PsycoWrapper import psyco from Products.ERP5Type.PsycoWrapper import psyco
from Acquisition import aq_base from Acquisition import aq_base
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
class TranslatedPropertyGetter(Method): class TranslatedPropertyGetter(BaseGetter):
""" """
Get the translated property Get the translated property
""" """
...@@ -65,7 +65,7 @@ class TranslatedPropertyGetter(Method): ...@@ -65,7 +65,7 @@ class TranslatedPropertyGetter(Method):
psyco.bind(__call__) psyco.bind(__call__)
class PropertyTranslationDomainGetter(Method): class PropertyTranslationDomainGetter(BaseGetter):
""" """
Get the translation domain Get the translation domain
""" """
......
...@@ -28,11 +28,11 @@ ...@@ -28,11 +28,11 @@
import warnings import warnings
from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Setter as BaseSetter, Getter as BaseGetter
from zLOG import LOG from zLOG import LOG
from Products.ERP5Type.PsycoWrapper import psyco from Products.ERP5Type.PsycoWrapper import psyco
class SetSetter(Method): class SetSetter(BaseSetter):
""" """
Sets a category value through a provided value (List mode) Sets a category value through a provided value (List mode)
""" """
...@@ -114,7 +114,7 @@ class DefaultSetter(SetSetter): ...@@ -114,7 +114,7 @@ class DefaultSetter(SetSetter):
psyco.bind(__call__) psyco.bind(__call__)
class DefaultGetter(Method): class DefaultGetter(BaseGetter):
""" """
Gets a default reference object Gets a default reference object
""" """
...@@ -142,7 +142,7 @@ class DefaultGetter(Method): ...@@ -142,7 +142,7 @@ class DefaultGetter(Method):
Getter = DefaultGetter Getter = DefaultGetter
class ListGetter(Method): class ListGetter(BaseGetter):
""" """
Gets a list of reference objects Gets a list of reference objects
""" """
...@@ -181,7 +181,7 @@ class SetGetter(ListGetter): ...@@ -181,7 +181,7 @@ class SetGetter(ListGetter):
return result_set return result_set
class DefaultTitleGetter(Method): class DefaultTitleGetter(BaseGetter):
""" """
Gets a default reference object Gets a default reference object
""" """
...@@ -207,7 +207,7 @@ class DefaultTitleGetter(Method): ...@@ -207,7 +207,7 @@ class DefaultTitleGetter(Method):
psyco.bind(__call__) psyco.bind(__call__)
class TitleListGetter(Method): class TitleListGetter(BaseGetter):
""" """
Gets a list of reference objects Gets a list of reference objects
""" """
...@@ -240,7 +240,7 @@ class TitleSetGetter(TitleListGetter): ...@@ -240,7 +240,7 @@ class TitleSetGetter(TitleListGetter):
return result_set return result_set
class DefaultTranslatedTitleGetter(Method): class DefaultTranslatedTitleGetter(BaseGetter):
""" """
Gets a default reference object Gets a default reference object
""" """
...@@ -270,7 +270,7 @@ class DefaultTranslatedTitleGetter(Method): ...@@ -270,7 +270,7 @@ class DefaultTranslatedTitleGetter(Method):
psyco.bind(__call__) psyco.bind(__call__)
class TranslatedTitleListGetter(Method): class TranslatedTitleListGetter(BaseGetter):
""" """
Gets a list of reference objects Gets a list of reference objects
""" """
...@@ -309,7 +309,7 @@ class TranslatedTitleSetGetter(TranslatedTitleListGetter): ...@@ -309,7 +309,7 @@ class TranslatedTitleSetGetter(TranslatedTitleListGetter):
return result_set return result_set
class DefaultReferenceGetter(Method): class DefaultReferenceGetter(BaseGetter):
""" """
Gets a default reference object Gets a default reference object
""" """
...@@ -339,7 +339,7 @@ class DefaultReferenceGetter(Method): ...@@ -339,7 +339,7 @@ class DefaultReferenceGetter(Method):
psyco.bind(__call__) psyco.bind(__call__)
class ReferenceListGetter(Method): class ReferenceListGetter(BaseGetter):
""" """
Gets a list of reference objects Gets a list of reference objects
""" """
...@@ -378,7 +378,7 @@ class ReferenceSetGetter(ReferenceListGetter): ...@@ -378,7 +378,7 @@ class ReferenceSetGetter(ReferenceListGetter):
return result_set return result_set
class DefaultUidGetter(Method): class DefaultUidGetter(BaseGetter):
""" """
Gets a default reference object Gets a default reference object
""" """
...@@ -411,7 +411,7 @@ class DefaultUidGetter(Method): ...@@ -411,7 +411,7 @@ class DefaultUidGetter(Method):
UidGetter = DefaultUidGetter UidGetter = DefaultUidGetter
class UidListGetter(Method): class UidListGetter(BaseGetter):
""" """
Gets a list of reference objects uid Gets a list of reference objects uid
""" """
...@@ -450,7 +450,7 @@ class UidSetGetter(UidListGetter): ...@@ -450,7 +450,7 @@ class UidSetGetter(UidListGetter):
return result_set return result_set
class UidSetSetter(Method): class UidSetSetter(BaseSetter):
""" """
Sets a category from the uid of the object Sets a category from the uid of the object
""" """
...@@ -525,7 +525,7 @@ class UidDefaultSetter(UidSetSetter): ...@@ -525,7 +525,7 @@ class UidDefaultSetter(UidSetSetter):
instance.reindexObject() instance.reindexObject()
return (instance, ) return (instance, )
class DefaultIdGetter(Method): class DefaultIdGetter(BaseGetter):
""" """
Gets a default reference object Gets a default reference object
""" """
...@@ -557,7 +557,7 @@ class DefaultIdGetter(Method): ...@@ -557,7 +557,7 @@ class DefaultIdGetter(Method):
IdGetter = DefaultIdGetter IdGetter = DefaultIdGetter
class DefaultTitleOrIdGetter(Method): class DefaultTitleOrIdGetter(BaseGetter):
""" """
Gets a default reference object Gets a default reference object
""" """
...@@ -589,7 +589,7 @@ class DefaultTitleOrIdGetter(Method): ...@@ -589,7 +589,7 @@ class DefaultTitleOrIdGetter(Method):
TitleOrIdGetter = DefaultTitleOrIdGetter TitleOrIdGetter = DefaultTitleOrIdGetter
class DefaultLogicalPathGetter(Method): class DefaultLogicalPathGetter(BaseGetter):
""" """
Gets a default logical path object Gets a default logical path object
""" """
...@@ -621,7 +621,7 @@ class DefaultLogicalPathGetter(Method): ...@@ -621,7 +621,7 @@ class DefaultLogicalPathGetter(Method):
LogicalPathGetter = DefaultLogicalPathGetter LogicalPathGetter = DefaultLogicalPathGetter
class IdListGetter(Method): class IdListGetter(BaseGetter):
""" """
Gets a list of reference objects uid Gets a list of reference objects uid
""" """
...@@ -660,7 +660,7 @@ class IdSetGetter(IdListGetter): ...@@ -660,7 +660,7 @@ class IdSetGetter(IdListGetter):
return result_set return result_set
class LogicalPathListGetter(Method): class LogicalPathListGetter(BaseGetter):
""" """
Gets a list of logical path Gets a list of logical path
""" """
...@@ -697,7 +697,7 @@ class LogicalPathSetGetter(LogicalPathListGetter): ...@@ -697,7 +697,7 @@ class LogicalPathSetGetter(LogicalPathListGetter):
return result_set return result_set
class DefaultPropertyGetter(Method): class DefaultPropertyGetter(BaseGetter):
""" """
Gets a default reference object Gets a default reference object
""" """
...@@ -730,7 +730,7 @@ class DefaultPropertyGetter(Method): ...@@ -730,7 +730,7 @@ class DefaultPropertyGetter(Method):
PropertyGetter = DefaultPropertyGetter PropertyGetter = DefaultPropertyGetter
class PropertyListGetter(Method): class PropertyListGetter(BaseGetter):
""" """
Gets a list of reference objects uid Gets a list of reference objects uid
""" """
......
...@@ -26,14 +26,13 @@ ...@@ -26,14 +26,13 @@
# #
############################################################################## ##############################################################################
from Accessor import Accessor as Method
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.ERP5Type.PsycoWrapper import psyco from Products.ERP5Type.PsycoWrapper import psyco
from Base import Getter as BaseGetter, Setter as BaseSetter
# Creation of default constructor # Creation of default constructor
class func_code: pass class func_code: pass
class Getter(Method): class Getter(BaseGetter):
""" """
Gets an attribute value. A default value can be Gets an attribute value. A default value can be
provided if needed provided if needed
...@@ -59,7 +58,7 @@ class Getter(Method): ...@@ -59,7 +58,7 @@ class Getter(Method):
psyco.bind(__call__) psyco.bind(__call__)
class TitleGetter(Method): class TitleGetter(BaseGetter):
""" """
Gets the title of the current state Gets the title of the current state
""" """
......
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