Zope2: use func_code if __code__ is missing, that is the case for Script (Python).
... | ... | @@ -165,6 +165,8 @@ class Alarm(XMLObject, PeriodicityMixin): |
tag = activate_kw['tag'] | ||
method = getattr(self, method_id) | ||
func_code = method.__code__ | ||
if func_code is None: # BBB Zope2 | ||
|
||
func_code = method.func_code | ||
try: | ||
has_kw = func_code.co_flags & CO_VARKEYWORDS | ||
except AttributeError: | ||
... | ... |
... | ... | @@ -1451,7 +1451,10 @@ class Catalog(Folder, |
if meta_type in self.HAS_ARGUMENT_SRC_METATYPE_SET: | ||
return method.arguments_src.split() | ||
elif meta_type in self.HAS_FUNC_CODE_METATYPE_SET: | ||
return method.__code__.co_varnames[:method.__code__.co_argcount] | ||
func_code = method.__code__ | ||
if func_code is None: # BBB Zope2 | ||
|
||
func_code = method.func_code | ||
return func_code.co_varnames[:func_code.co_argcount] | ||
# Note: Raising here would completely prevent indexation from working. | ||
# Instead, let the method actually fail when called, so _catalogObjectList | ||
# can log the error and carry on. | ||
... | ... | @@ -1838,6 +1841,8 @@ class Catalog(Folder, |
search_key = self.getSearchKey(key, 'RelatedKey') | ||
else: | ||
func_code = script.__code__ | ||
if func_code is None: # BBB Zope2 | ||
func_code = script.func_code | ||
search_key = ( | ||
AdvancedSearchKeyWrapperForScriptableKey if ( | ||
# 5: search_value (under any name), "search_key", "group", | ||
... | ... |
-
mentioned in commit a3437c62
-
mentioned in commit levin.zimmermann/erp5@7d137894