Commit 2b6f5bd9 authored by Nicolas Delaby's avatar Nicolas Delaby

Look up in all ancestors class tree until Base

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25012 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c2042d82
...@@ -2915,9 +2915,10 @@ class Base( CopyContainer, ...@@ -2915,9 +2915,10 @@ class Base( CopyContainer,
fallback_script_id : the script to use if nothing is found fallback_script_id : the script to use if nothing is found
""" """
def getScriptName(portal_type, method_id): 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 script_name_end = '_%s' % method_id
for script_name_begin in [portal_type, self.getMetaType(), for script_name_begin in [portal_type, self.getMetaType()] + class_name_list:
self.__class__.__name__]:
name = ''.join([script_name_begin.replace(' ',''), script_name_end]) name = ''.join([script_name_begin.replace(' ',''), script_name_end])
script = getattr(self, name, None) script = getattr(self, name, None)
if script is not None: if script is not None:
......
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