Commit 7a2c616e authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

fixup! Zope2: use func_code if __code__ is missing, that is the case for Script (Python).

parent baf1e4c1
...@@ -1451,7 +1451,7 @@ class Catalog(Folder, ...@@ -1451,7 +1451,7 @@ class Catalog(Folder,
if meta_type in self.HAS_ARGUMENT_SRC_METATYPE_SET: if meta_type in self.HAS_ARGUMENT_SRC_METATYPE_SET:
return method.arguments_src.split() return method.arguments_src.split()
elif meta_type in self.HAS_FUNC_CODE_METATYPE_SET: elif meta_type in self.HAS_FUNC_CODE_METATYPE_SET:
func_code = method.__code__ func_code = getattr(method, '__code__', None)
if func_code is None: # BBB Zope2 if func_code is None: # BBB Zope2
func_code = method.func_code func_code = method.func_code
return func_code.co_varnames[:func_code.co_argcount] return func_code.co_varnames[:func_code.co_argcount]
...@@ -1840,7 +1840,7 @@ class Catalog(Folder, ...@@ -1840,7 +1840,7 @@ class Catalog(Folder,
else: else:
search_key = self.getSearchKey(key, 'RelatedKey') search_key = self.getSearchKey(key, 'RelatedKey')
else: else:
func_code = script.__code__ func_code = getattr(script, '__code__', None)
if func_code is None: # BBB Zope2 if func_code is None: # BBB Zope2
func_code = script.func_code func_code = script.func_code
search_key = ( search_key = (
......
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