Commit 8f5c7021 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Apply psyco for all getters. Also, rewrite some methods by using list comprehesions instead of map.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3175 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6eb8eb8a
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
############################################################################## ##############################################################################
from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method
from Products.ERP5Type.PsycoWrapper import psyco
class DefaultGetter(Method): class DefaultGetter(Method):
""" """
...@@ -98,6 +99,8 @@ class DefaultGetter(Method): ...@@ -98,6 +99,8 @@ class DefaultGetter(Method):
is_tales_type=is_tales_type is_tales_type=is_tales_type
) )
psyco.bind(__call__)
Getter = DefaultGetter Getter = DefaultGetter
class ListGetter(Method): class ListGetter(Method):
...@@ -170,4 +173,6 @@ class ListGetter(Method): ...@@ -170,4 +173,6 @@ class ListGetter(Method):
is_tales_type=is_tales_type is_tales_type=is_tales_type
) )
psyco.bind(__call__)
SetGetter = ListGetter # ERROR SetGetter = ListGetter # ERROR
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
############################################################################## ##############################################################################
from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method
from Products.ERP5Type.PsycoWrapper import psyco
class Getter(Method): class Getter(Method):
""" """
...@@ -96,6 +97,8 @@ class Getter(Method): ...@@ -96,6 +97,8 @@ class Getter(Method):
else: else:
return default return default
psyco.bind(__call__)
class Setter(Method): class Setter(Method):
""" """
Gets the default reference of a relation Gets the default reference of a relation
......
...@@ -33,6 +33,7 @@ from Acquisition import aq_base ...@@ -33,6 +33,7 @@ from Acquisition import aq_base
from zLOG import LOG from zLOG import LOG
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5Type.PsycoWrapper import psyco
# Creation of default constructor # Creation of default constructor
class func_code: pass class func_code: pass
...@@ -140,6 +141,8 @@ class Getter(Method): ...@@ -140,6 +141,8 @@ class Getter(Method):
return value return value
return default return default
psyco.bind(__call__)
class Tester(Method): class Tester(Method):
""" """
Tests if an attribute value exists Tests if an attribute value exists
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method
from zLOG import LOG from zLOG import LOG
from Products.ERP5Type.PsycoWrapper import psyco
class Setter(Method): class Setter(Method):
""" """
...@@ -143,6 +144,7 @@ class DefaultGetter(Method): ...@@ -143,6 +144,7 @@ class DefaultGetter(Method):
filter=kw.get('filter', None), filter=kw.get('filter', None),
portal_type=kw.get('portal_type',()), portal_type=kw.get('portal_type',()),
base=0) base=0)
psyco.bind(__call__)
class ListGetter(Method): class ListGetter(Method):
""" """
...@@ -164,6 +166,7 @@ class ListGetter(Method): ...@@ -164,6 +166,7 @@ class ListGetter(Method):
def __call__(self, instance, *args, **kw): def __call__(self, instance, *args, **kw):
return instance._getAcquiredCategoryMembershipList(self._key, base=0, **kw) return instance._getAcquiredCategoryMembershipList(self._key, base=0, **kw)
psyco.bind(__call__)
SetGetter = ListGetter # XXX ERROR SetGetter = ListGetter # XXX ERROR
...@@ -190,5 +193,7 @@ class ItemListGetter(Method): ...@@ -190,5 +193,7 @@ class ItemListGetter(Method):
def __call__(self, instance, *args, **kw): def __call__(self, instance, *args, **kw):
return instance._getAcquiredCategoryMembershipItemList(self._key, base=0, **kw) return instance._getAcquiredCategoryMembershipItemList(self._key, base=0, **kw)
psyco.bind(__call__)
# And Tester ??? # And Tester ???
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method
import Base import Base
from Products.ERP5Type.PsycoWrapper import psyco
Setter = Base.Setter Setter = Base.Setter
DefaultSetter = Base.Setter DefaultSetter = Base.Setter
...@@ -84,6 +85,8 @@ class ValueGetter(Method): ...@@ -84,6 +85,8 @@ class ValueGetter(Method):
return o return o
return default_result return default_result
psyco.bind(__call__)
class ValueListGetter(Method): class ValueListGetter(Method):
""" """
Gets an attribute value. A default value can be Gets an attribute value. A default value can be
...@@ -114,8 +117,9 @@ class ValueListGetter(Method): ...@@ -114,8 +117,9 @@ class ValueListGetter(Method):
def __call__(self, instance, *args, **kw): def __call__(self, instance, *args, **kw):
# We return the list of matching objects # We return the list of matching objects
return map(lambda o:o.getObject(), return [o.getObject() for x in self.contentValues({'portal_type': self._portal_type, 'id': self._storage_id_list})]
self.contentValues({'portal_type': self._portal_type, 'id': self._storage_id_list}))
psyco.bind(__call__)
DefaultValueGetter = ValueGetter DefaultValueGetter = ValueGetter
...@@ -163,6 +167,8 @@ class Getter(Method): ...@@ -163,6 +167,8 @@ class Getter(Method):
#return o #return o
return default_result return default_result
psyco.bind(__call__)
class ListGetter(Method): class ListGetter(Method):
""" """
Gets an attribute value. A default value can be Gets an attribute value. A default value can be
...@@ -192,8 +198,9 @@ class ListGetter(Method): ...@@ -192,8 +198,9 @@ class ListGetter(Method):
def __call__(self, instance, *args, **kw): def __call__(self, instance, *args, **kw):
# We return the list of matching objects # We return the list of matching objects
return map(lambda o:o.relative_url, return [o.relative_url for o in self.searchFolder(portal_type = self._portal_type, id = self._storage_id_list)]
self.searchFolder(portal_type = self._portal_type, id = self._storage_id_list))
psyco.bind(__call__)
DefaultGetter = Getter DefaultGetter = Getter
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method
import Base import Base
from Products.ERP5Type.PsycoWrapper import psyco
Setter = Base.Setter Setter = Base.Setter
DefaultSetter = Base.Setter DefaultSetter = Base.Setter
...@@ -85,6 +86,8 @@ class ValueGetter(Method): ...@@ -85,6 +86,8 @@ class ValueGetter(Method):
return o return o
return default_result return default_result
psyco.bind(__call__)
class ValueListGetter(Method): class ValueListGetter(Method):
""" """
Gets an attribute value. A default value can be Gets an attribute value. A default value can be
...@@ -116,8 +119,9 @@ class ValueListGetter(Method): ...@@ -116,8 +119,9 @@ class ValueListGetter(Method):
def __call__(self, instance, *args, **kw): def __call__(self, instance, *args, **kw):
# We return the list of matching objects # We return the list of matching objects
return map(lambda o:o.getObject(), return [o.getObject() for o in self.contentValues({'portal_type': self._portal_type, 'id': self._storage_id_list})]
self.contentValues({'portal_type': self._portal_type, 'id': self._storage_id_list}))
psyco.bind(__call__)
DefaultValueGetter = ValueGetter DefaultValueGetter = ValueGetter
...@@ -166,6 +170,8 @@ class Getter(Method): ...@@ -166,6 +170,8 @@ class Getter(Method):
return o.getProperty(self._acquired_property, default) return o.getProperty(self._acquired_property, default)
return default return default
psyco.bind(__call__)
class Setter(Method): class Setter(Method):
""" """
Gets an attribute value. A default value can be Gets an attribute value. A default value can be
...@@ -248,8 +254,9 @@ class ListGetter(Method): ...@@ -248,8 +254,9 @@ class ListGetter(Method):
def __call__(self, instance, *args, **kw): def __call__(self, instance, *args, **kw):
# We return the list of matching objects # We return the list of matching objects
return map(lambda o:o.relative_url, return [o.relative_url for o in self.searchFolder(portal_type = self._portal_type, id = self._storage_id_list)]
self.searchFolder(portal_type = self._portal_type, id = self._storage_id_list))
psyco.bind(__call__)
DefaultGetter = Getter DefaultGetter = Getter
......
...@@ -33,6 +33,7 @@ import Base ...@@ -33,6 +33,7 @@ import Base
from Products.CMFCore.Expression import Expression from Products.CMFCore.Expression import Expression
from Products.ERP5Type.Utils import createExpressionContext from Products.ERP5Type.Utils import createExpressionContext
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5Type.PsycoWrapper import psyco
from zLOG import LOG from zLOG import LOG
...@@ -253,6 +254,8 @@ class DefaultGetter(Method): ...@@ -253,6 +254,8 @@ class DefaultGetter(Method):
return list_value[0] return list_value[0]
return default return default
psyco.bind(__call__)
Getter = DefaultGetter Getter = DefaultGetter
class ListGetter(Method): class ListGetter(Method):
...@@ -297,6 +300,8 @@ class ListGetter(Method): ...@@ -297,6 +300,8 @@ class ListGetter(Method):
return list(list_value) return list(list_value)
return default return default
psyco.bind(__call__)
SetGetter = ListGetter SetGetter = ListGetter
Tester = Base.Tester Tester = Base.Tester
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method
import Base import Base
from Products.ERP5Type.PsycoWrapper import psyco
Setter = Base.Setter Setter = Base.Setter
DefaultSetter = Base.Setter DefaultSetter = Base.Setter
...@@ -76,6 +77,8 @@ class ValueGetter(Method): ...@@ -76,6 +77,8 @@ class ValueGetter(Method):
return o return o
return default_result return default_result
psyco.bind(__call__)
class ValueListGetter(Method): class ValueListGetter(Method):
""" """
Gets an attribute value. A default value can be Gets an attribute value. A default value can be
...@@ -105,8 +108,9 @@ class ValueListGetter(Method): ...@@ -105,8 +108,9 @@ class ValueListGetter(Method):
def __call__(self, instance, *args, **kw): def __call__(self, instance, *args, **kw):
# We return the list of matching objects # We return the list of matching objects
return map(lambda o:o.getObject(), return [o.getObject() for o in self.contentValues({'portal_type': self._portal_type, 'id': self._storage_id_list})]
self.contentValues({'portal_type': self._portal_type, 'id': self._storage_id_list}))
psyco.bind(__call__)
DefaultValueGetter = ValueGetter DefaultValueGetter = ValueGetter
...@@ -150,6 +154,8 @@ class Getter(Method): ...@@ -150,6 +154,8 @@ class Getter(Method):
return o.getRelativeUrl() return o.getRelativeUrl()
return default_result return default_result
psyco.bind(__call__)
class ListGetter(Method): class ListGetter(Method):
""" """
Gets an attribute value. A default value can be Gets an attribute value. A default value can be
...@@ -179,8 +185,9 @@ class ListGetter(Method): ...@@ -179,8 +185,9 @@ class ListGetter(Method):
def __call__(self, instance, *args, **kw): def __call__(self, instance, *args, **kw):
# We return the list of matching objects # We return the list of matching objects
return map(lambda o:o.relative_url, return [o.relative_url for o in self.searchFolder(portal_type = self._portal_type, id = self._storage_id_list)]
self.searchFolder(portal_type = self._portal_type, id = self._storage_id_list))
psyco.bind(__call__)
DefaultGetter = Getter DefaultGetter = Getter
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
############################################################################## ##############################################################################
from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method
from Products.ERP5Type.PsycoWrapper import psyco
class DefaultGetter(Method): class DefaultGetter(Method):
""" """
...@@ -55,6 +56,8 @@ class DefaultGetter(Method): ...@@ -55,6 +56,8 @@ class DefaultGetter(Method):
filter=kw.get('filter', None), filter=kw.get('filter', None),
portal_type=kw.get('portal_type',())) portal_type=kw.get('portal_type',()))
psyco.bind(__call__)
Getter = DefaultGetter Getter = DefaultGetter
class ListGetter(Method): class ListGetter(Method):
...@@ -84,4 +87,6 @@ class ListGetter(Method): ...@@ -84,4 +87,6 @@ class ListGetter(Method):
filter=kw.get('filter', None), filter=kw.get('filter', None),
portal_type=kw.get('portal_type',())) portal_type=kw.get('portal_type',()))
psyco.bind(__call__)
SetGetter = ListGetter SetGetter = ListGetter
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
############################################################################## ##############################################################################
from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method
from Products.ERP5Type.PsycoWrapper import psyco
class DefaultGetter(Method): class DefaultGetter(Method):
""" """
...@@ -55,6 +56,8 @@ class DefaultGetter(Method): ...@@ -55,6 +56,8 @@ class DefaultGetter(Method):
filter=kw.get('filter', None), filter=kw.get('filter', None),
portal_type=kw.get('portal_type',())) portal_type=kw.get('portal_type',()))
psyco.bind(__call__)
Getter = DefaultGetter Getter = DefaultGetter
class ListGetter(Method): class ListGetter(Method):
...@@ -84,6 +87,8 @@ class ListGetter(Method): ...@@ -84,6 +87,8 @@ class ListGetter(Method):
filter=kw.get('filter', None), filter=kw.get('filter', None),
portal_type=kw.get('portal_type',())) portal_type=kw.get('portal_type',()))
psyco.bind(__call__)
SetGetter = ListGetter # Error XXX SetGetter = ListGetter # Error XXX
class DefaultIdGetter(Method): class DefaultIdGetter(Method):
...@@ -113,6 +118,8 @@ class DefaultIdGetter(Method): ...@@ -113,6 +118,8 @@ class DefaultIdGetter(Method):
filter=kw.get('filter', None), filter=kw.get('filter', None),
portal_type=kw.get('portal_type',())) portal_type=kw.get('portal_type',()))
psyco.bind(__call__)
IdGetter = DefaultIdGetter IdGetter = DefaultIdGetter
class IdListGetter(Method): class IdListGetter(Method):
...@@ -142,6 +149,8 @@ class IdListGetter(Method): ...@@ -142,6 +149,8 @@ class IdListGetter(Method):
filter=kw.get('filter', None), filter=kw.get('filter', None),
portal_type=kw.get('portal_type',())) portal_type=kw.get('portal_type',()))
psyco.bind(__call__)
IdSetGetter = IdListGetter # XXX Error IdSetGetter = IdListGetter # XXX Error
class DefaultTitleGetter(Method): class DefaultTitleGetter(Method):
...@@ -171,6 +180,8 @@ class DefaultTitleGetter(Method): ...@@ -171,6 +180,8 @@ class DefaultTitleGetter(Method):
filter=kw.get('filter', None), filter=kw.get('filter', None),
portal_type=kw.get('portal_type',())) portal_type=kw.get('portal_type',()))
psyco.bind(__call__)
TitleGetter = DefaultTitleGetter TitleGetter = DefaultTitleGetter
class TitleListGetter(Method): class TitleListGetter(Method):
...@@ -200,6 +211,8 @@ class TitleListGetter(Method): ...@@ -200,6 +211,8 @@ class TitleListGetter(Method):
filter=kw.get('filter', None), filter=kw.get('filter', None),
portal_type=kw.get('portal_type',())) portal_type=kw.get('portal_type',()))
psyco.bind(__call__)
TitleSetGetter = TitleListGetter # XXX Error TitleSetGetter = TitleListGetter # XXX Error
class DefaultPropertyGetter(Method): class DefaultPropertyGetter(Method):
...@@ -229,6 +242,8 @@ class DefaultPropertyGetter(Method): ...@@ -229,6 +242,8 @@ class DefaultPropertyGetter(Method):
filter=kw.get('filter', None), filter=kw.get('filter', None),
portal_type=kw.get('portal_type',())) portal_type=kw.get('portal_type',()))
psyco.bind(__call__)
PropertyGetter = DefaultPropertyGetter PropertyGetter = DefaultPropertyGetter
class PropertyListGetter(Method): class PropertyListGetter(Method):
...@@ -258,4 +273,6 @@ class PropertyListGetter(Method): ...@@ -258,4 +273,6 @@ class PropertyListGetter(Method):
filter=kw.get('filter', None), filter=kw.get('filter', None),
portal_type=kw.get('portal_type',())) portal_type=kw.get('portal_type',()))
psyco.bind(__call__)
PropertySetGetter = PropertyListGetter # Error XXX PropertySetGetter = PropertyListGetter # Error XXX
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method
from zLOG import LOG from zLOG import LOG
from Products.ERP5Type.PsycoWrapper import psyco
class Setter(Method): class Setter(Method):
""" """
...@@ -53,6 +54,8 @@ class Setter(Method): ...@@ -53,6 +54,8 @@ class Setter(Method):
portal_type=kw.get('portal_type',())) portal_type=kw.get('portal_type',()))
if self._reindex: instance.reindexObject() if self._reindex: instance.reindexObject()
psyco.bind(__call__)
ListSetter = Setter ListSetter = Setter
SetSetter = Setter # Error XXX SetSetter = Setter # Error XXX
DefaultSetter = Setter # Error XXX DefaultSetter = Setter # Error XXX
...@@ -81,6 +84,8 @@ class DefaultGetter(Method): ...@@ -81,6 +84,8 @@ class DefaultGetter(Method):
LOG("ERP5Type Deprecated Getter Id:",0, self._id) LOG("ERP5Type Deprecated Getter Id:",0, self._id)
return instance._getDefaultAcquiredValue(self._key, **kw) return instance._getDefaultAcquiredValue(self._key, **kw)
psyco.bind(__call__)
Getter = DefaultGetter Getter = DefaultGetter
class ListGetter(Method): class ListGetter(Method):
...@@ -106,9 +111,11 @@ class ListGetter(Method): ...@@ -106,9 +111,11 @@ class ListGetter(Method):
def __call__(self, instance, *args, **kw): def __call__(self, instance, *args, **kw):
if self._warning: if self._warning:
LOG("ERP5Type Deprecated Getter Id:",0, self._id) LOG("ERP5Type Deprecated Getter Id:",0, self._id)
LOG("__call__:",0, str((args,kw))) #LOG("__call__:",0, str((args,kw)))
return instance._getAcquiredValueList(self._key, **kw) return instance._getAcquiredValueList(self._key, **kw)
psyco.bind(__call__)
SetGetter = ListGetter # Error XXX SetGetter = ListGetter # Error XXX
...@@ -139,6 +146,8 @@ class DefaultTitleGetter(Method): ...@@ -139,6 +146,8 @@ class DefaultTitleGetter(Method):
return None return None
return o.getTitle() return o.getTitle()
psyco.bind(__call__)
class TitleListGetter(Method): class TitleListGetter(Method):
""" """
Gets a list of reference objects Gets a list of reference objects
...@@ -158,11 +167,13 @@ class TitleListGetter(Method): ...@@ -158,11 +167,13 @@ class TitleListGetter(Method):
self._key = key self._key = key
def __call__(self, instance, *args, **kw): def __call__(self, instance, *args, **kw):
return map(lambda x:x.getTitle(), instance._getAcquiredValueList(self._key, return [x.getTitle() for x in instance._getAcquiredValueList(self._key,
spec=kw.get('spec',()), spec=kw.get('spec',()),
filter=kw.get('filter', None), filter=kw.get('filter', None),
portal_type=kw.get('portal_type',())) portal_type=kw.get('portal_type',()))
) ]
psyco.bind(__call__)
TitleSetGetter = TitleListGetter # Error XXX TitleSetGetter = TitleListGetter # Error XXX
...@@ -194,6 +205,8 @@ class DefaultUidGetter(Method): ...@@ -194,6 +205,8 @@ class DefaultUidGetter(Method):
else: else:
return None return None
psyco.bind(__call__)
UidGetter = DefaultUidGetter UidGetter = DefaultUidGetter
class UidListGetter(Method): class UidListGetter(Method):
...@@ -215,11 +228,14 @@ class UidListGetter(Method): ...@@ -215,11 +228,14 @@ class UidListGetter(Method):
self._key = key self._key = key
def __call__(self, instance, *args, **kw): def __call__(self, instance, *args, **kw):
return map(lambda x:x.getUid(), instance._getAcquiredValueList(self._key, return [x.getUid() for x in instance._getAcquiredValueList(self._key,
spec=kw.get('spec',()), spec=kw.get('spec',()),
filter=kw.get('filter', None), filter=kw.get('filter', None),
portal_type=kw.get('portal_type',())) portal_type=kw.get('portal_type',()))
) ]
psyco.bind(__call__)
UidSetGetter = UidListGetter # Error XXX UidSetGetter = UidListGetter # Error XXX
class UidSetter(Method): class UidSetter(Method):
...@@ -275,6 +291,8 @@ class DefaultIdGetter(Method): ...@@ -275,6 +291,8 @@ class DefaultIdGetter(Method):
else: else:
return None return None
psyco.bind(__call__)
IdGetter = DefaultIdGetter IdGetter = DefaultIdGetter
class DefaultTitleOrIdGetter(Method): class DefaultTitleOrIdGetter(Method):
...@@ -302,6 +320,8 @@ class DefaultTitleOrIdGetter(Method): ...@@ -302,6 +320,8 @@ class DefaultTitleOrIdGetter(Method):
else: else:
return None return None
psyco.bind(__call__)
TitleOrIdGetter = DefaultTitleOrIdGetter TitleOrIdGetter = DefaultTitleOrIdGetter
class DefaultLogicalPathGetter(Method): class DefaultLogicalPathGetter(Method):
...@@ -329,6 +349,8 @@ class DefaultLogicalPathGetter(Method): ...@@ -329,6 +349,8 @@ class DefaultLogicalPathGetter(Method):
else: else:
return None return None
psyco.bind(__call__)
LogicalPathGetter = DefaultLogicalPathGetter LogicalPathGetter = DefaultLogicalPathGetter
class IdListGetter(Method): class IdListGetter(Method):
...@@ -350,11 +372,13 @@ class IdListGetter(Method): ...@@ -350,11 +372,13 @@ class IdListGetter(Method):
self._key = key self._key = key
def __call__(self, instance, *args, **kw): def __call__(self, instance, *args, **kw):
return map(lambda x:x.getId(), instance._getAcquiredValueList(self._key, return [x.getId() for x in instance._getAcquiredValueList(self._key,
spec=kw.get('spec',()), spec=kw.get('spec',()),
filter=kw.get('filter', None), filter=kw.get('filter', None),
portal_type=kw.get('portal_type',())) portal_type=kw.get('portal_type',()))
) ]
psyco.bind(__call__)
IdSetGetter = IdListGetter # Error XXX IdSetGetter = IdListGetter # Error XXX
...@@ -377,11 +401,11 @@ class LogicalPathListGetter(Method): ...@@ -377,11 +401,11 @@ class LogicalPathListGetter(Method):
self._key = key self._key = key
def __call__(self, instance, *args, **kw): def __call__(self, instance, *args, **kw):
return map(lambda x:x.getLogicalPath(), instance._getAcquiredValueList(self._key, return [x.getLogicalPath() for x in instance._getAcquiredValueList(self._key,
spec=kw.get('spec',()), spec=kw.get('spec',()),
filter=kw.get('filter', None), filter=kw.get('filter', None),
portal_type=kw.get('portal_type',())) portal_type=kw.get('portal_type',()))
) ]
LogicalPathSetGetter = LogicalPathListGetter # Error XXX LogicalPathSetGetter = LogicalPathListGetter # Error XXX
...@@ -413,6 +437,8 @@ class DefaultPropertyGetter(Method): ...@@ -413,6 +437,8 @@ class DefaultPropertyGetter(Method):
else: else:
return None return None
psyco.bind(__call__)
PropertyGetter = DefaultPropertyGetter PropertyGetter = DefaultPropertyGetter
class PropertyListGetter(Method): class PropertyListGetter(Method):
...@@ -434,9 +460,12 @@ class PropertyListGetter(Method): ...@@ -434,9 +460,12 @@ class PropertyListGetter(Method):
self._key = key self._key = key
def __call__(self, instance, key, *args, **kw): def __call__(self, instance, key, *args, **kw):
return map(lambda x:x.getProperty(key), instance._getAcquiredValueList(self._key, return [x.getProperty(key) for x in instance._getAcquiredValueList(self._key,
spec=kw.get('spec',()), spec=kw.get('spec',()),
filter=kw.get('filter', None), filter=kw.get('filter', None),
portal_type=kw.get('portal_type',())) portal_type=kw.get('portal_type',()))
) ]
psyco.bind(__call__)
PropertySetGetter = PropertyListGetter # Error XXX PropertySetGetter = PropertyListGetter # Error XXX
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
from Accessor import Accessor as Method from Accessor import Accessor as Method
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.ERP5Type.PsycoWrapper import psyco
# Creation of default constructor # Creation of default constructor
class func_code: pass class func_code: pass
...@@ -56,6 +57,8 @@ class Getter(Method): ...@@ -56,6 +57,8 @@ class Getter(Method):
wf = portal_workflow.getWorkflowById(self._key) wf = portal_workflow.getWorkflowById(self._key)
return wf._getWorkflowStateOf(instance, id_only=1) return wf._getWorkflowStateOf(instance, id_only=1)
psyco.bind(__call__)
class TitleGetter(Method): class TitleGetter(Method):
""" """
Gets the title of the current state Gets the title of the current state
...@@ -79,3 +82,5 @@ class TitleGetter(Method): ...@@ -79,3 +82,5 @@ class TitleGetter(Method):
wf = portal_workflow.getWorkflowById(self._key) wf = portal_workflow.getWorkflowById(self._key)
return wf._getWorkflowStateOf(instance).title return wf._getWorkflowStateOf(instance).title
psyco.bind(__call__)
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