Commit b0cc66cc authored by Rafael Monnerat's avatar Rafael Monnerat

Re-apply http://svn.erp5.org/?view=revision&revision=33677 But now using...

Re-apply http://svn.erp5.org/?view=revision&revision=33677 But now using aq_inner instead aq_base (Thanks Julien M.)

this will prevent authorization problems due acquisition.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35695 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 508c090d
......@@ -3083,16 +3083,6 @@ class Base( CopyContainer,
fallback_script_id : the script to use if nothing is found
"""
def getScriptName(portal_type, method_id):
from Products.ERP5Type.Base import Base
class_name_list = [base_class.__name__ for base_class in self.__class__.mro() if issubclass(base_class, Base)]
script_name_end = '_%s' % method_id
for script_name_begin in [portal_type, self.getMetaType()] + class_name_list:
name = ''.join([script_name_begin.replace(' ',''), script_name_end])
script = getattr(self, name, None)
if script is not None:
return name
# script_id should not be used any more, keep compatibility
if script_id is not None:
LOG('ERP5Type/Base.getTypeBaseMethod',0,
......@@ -3107,12 +3097,22 @@ class Base( CopyContainer,
cache_key = (portal_type, method_id)
try:
name = type_base_cache[cache_key]
script = type_base_cache[cache_key]
except KeyError:
name = getScriptName(portal_type, method_id)
type_base_cache[cache_key] = name
if name is not None:
return getattr(self, name)
class_name_list = [portal_type, self.getMetaType()] + \
[base_class.__name__ for base_class in self.__class__.mro()
if issubclass(base_class, Base)]
script_name_end = '_' + method_id
for script_name_begin in class_name_list:
script_id = script_name_begin.replace(' ','') + script_name_end
script = getattr(self, script_id, None)
if script is not None:
type_base_cache[cache_key] = aq_inner(script)
return script
type_base_cache[cache_key] = None
if script is not None:
return script.__of__(self)
if fallback_script_id is not None:
return getattr(self, fallback_script_id)
......
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