Commit 3b290556 authored by Arnaud Fontaine's avatar Arnaud Fontaine

py3: func_{code,defaults} => __{code,defaults}__.

parent 736121df
......@@ -592,8 +592,9 @@ class BaseTemplateItem(Implicit, Persistent):
# `expression_instance` is included so as to add compatibility for
# exporting older catalog methods which might have them as their
# properties or in their attribute dict.
attr_set.update(('func_code', 'func_defaults', '_code',
'_lazy_compilation', 'Python_magic',
attr_set.update(('func_code', '__code__',
'func_defaults', '__defaults__',
'_code', '_lazy_compilation', 'Python_magic',
'expression_instance'))
for attr in 'errors', 'warnings', '_proxy_roles':
if not obj.__dict__.get(attr, 1):
......
......@@ -56,10 +56,10 @@ class func_code: pass
class PreferenceMethod(Method):
""" A method object that lookup the attribute on preferences. """
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self', )
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self', )
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, attribute, default):
self.__name__ = self._preference_getter = attribute
......
......@@ -54,7 +54,7 @@ allow_class(BrokenProxyField)
class WidgetDelegatedMethod(Method):
"""Method delegated to the proxied field's widget.
"""
func_code = None
__code__ = func_code = None
def __init__(self, method_id, default=''):
self._method_id = method_id
......@@ -68,7 +68,7 @@ class WidgetDelegatedMethod(Method):
try:
return proxied_method(field, *args, **kw)
finally:
self.func_code = getattr(proxied_method, 'func_code', None)
self.__code__ = self.__code__ = getattr(proxied_method, '__code__', None)
return self._default
......
......@@ -38,10 +38,10 @@ class DefaultGetter(BaseGetter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, default,
acquisition_base_category,
......@@ -125,10 +125,10 @@ class ListGetter(BaseGetter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, default,
acquisition_base_category,
......
......@@ -41,10 +41,10 @@ class Getter(BaseGetter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self', 'args', 'kw')
func_code.co_argcount = 1
func_defaults = None
__code__ = func_code = func_code()
__code__.co_varnames = ('self', 'args', 'kw')
__code__.co_argcount = 1
__defaults__ = func_defaults = None
def __init__(self, id, key, property_type, portal_type, acquired_property,
acquisition_base_category,
......@@ -127,10 +127,10 @@ class Setter(BaseSetter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self', 'value', 'args', 'kw')
func_code.co_argcount = 2
func_defaults = None
__code__ = func_code = func_code()
__code__.co_varnames = ('self', 'value', 'args', 'kw')
__code__.co_argcount = 2
__defaults__ = func_defaults = None
def __init__(self, id, key, property_type, portal_type, acquired_property,
acquisition_base_category,
......@@ -209,10 +209,10 @@ class Tester(BaseTester):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, portal_type, acquired_property,
acquisition_base_category,
......
......@@ -43,10 +43,10 @@ class Reindex(Setter):
# Generic Definition of Method Object
# This is required to call the method form the Web
# More information at http://www.zope.org/Members/htrd/howto/FunctionTemplate
func_code = func_code()
func_code.co_varnames = ('self', 'value') # XXX - This part should be configurable at instanciation
func_code.co_argcount = 2
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self', 'value') # XXX - This part should be configurable at instanciation
__code__.co_argcount = 2
__defaults__ = func_defaults = ()
def __init__(self, id, accessor_id):
self._id = id
......@@ -73,16 +73,16 @@ class Dummy(Reindex):
# Generic Definition of Method Object
# This is required to call the method form the Web
# More information at http://www.zope.org/Members/htrd/howto/FunctionTemplate
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, accessor_id):
self._id = id
self.__name__ = id
self._accessor_id = accessor_id
# self.func_code = getattr(instance, self._accessor_id).func_code
# self.__code__ = func_code = getattr(instance, self._accessor_id).func_code
def __call__(self, instance, *args, **kw):
method = getattr(instance, self._accessor_id)
......
......@@ -52,10 +52,10 @@ class Setter(Method):
# Generic Definition of Method Object
# This is required to call the method form the Web
# More information at http://www.zope.org/Members/htrd/howto/FunctionTemplate
func_code = func_code()
func_code.co_varnames = ('self', 'value')
func_code.co_argcount = 2
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self', 'value')
__code__.co_argcount = 2
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, storage_id=None):
self._id = id
......@@ -149,10 +149,10 @@ class Getter(Method):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, default=None, storage_id=None):
self._id = id
......@@ -211,10 +211,10 @@ class Tester(Method):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, storage_id=None):
self._id = id
......
......@@ -41,10 +41,10 @@ class ListSetter(BaseSetter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self', 'category')
func_code.co_argcount = 2
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self', 'category')
__code__.co_argcount = 2
__defaults__ = func_defaults = ()
def __init__(self, id, key):
self._id = id
......@@ -71,10 +71,10 @@ class DefaultSetter(BaseSetter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self', 'category')
func_code.co_argcount = 2
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self', 'category')
__code__.co_argcount = 2
__defaults__ = func_defaults = ()
def __init__(self, id, key):
self._id = id
......@@ -119,10 +119,10 @@ class DefaultGetter(BaseGetter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key):
self._id = id
......@@ -143,10 +143,10 @@ class ListGetter(BaseGetter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key):
self._id = id
......@@ -178,10 +178,10 @@ class ItemListGetter(BaseGetter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self', 'args', 'kw',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self', 'args', 'kw',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key):
self._id = id
......
......@@ -39,10 +39,10 @@ class PropertyGetter:
issues when we wish to make a property a method. For instance,
we would like to change from isIndexable=1 to a method isIndexable().
"""
func_code = func_code()
func_code.co_varnames = ()
func_code.co_argcount = 0
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ()
__code__.co_argcount = 0
__defaults__ = func_defaults = ()
def __init__(self, id, value=None):
self._id = id
......@@ -84,10 +84,10 @@ class Getter(Accessor):
# Generic Definition of Method Object
# This is required to call the method form the Web
# More information at http://www.zope.org/Members/htrd/howto/FunctionTemplate
func_code = func_code()
func_code.co_varnames = ('self', )
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self', )
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, value=None):
self._id = id
......
......@@ -47,10 +47,10 @@ class ValueGetter(Base.Getter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, portal_type=None, storage_id=None, default=None):
self._id = id
......@@ -97,10 +97,10 @@ class ValueListGetter(Base.Getter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, portal_type=None, storage_id=None, default=None):
self._id = id
......@@ -134,10 +134,10 @@ class Getter(Base.Getter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, portal_type=None, storage_id=None, default=None):
self._id = id
......@@ -180,10 +180,10 @@ class ListGetter(Base.Getter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, portal_type=None, storage_id=None):
self._id = id
......@@ -216,10 +216,10 @@ class Tester(Method):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, storage_id=None):
self._id = id
......
......@@ -50,10 +50,10 @@ class ValueGetter(Base.Getter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, acquired_property,
portal_type=None, storage_id=None, default=None):
......@@ -93,10 +93,10 @@ class ValueListGetter(Base.Getter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, acquired_property,
portal_type=None, storage_id=None, default=None):
......@@ -132,10 +132,10 @@ class Getter(Base.Getter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self', 'args', 'kw')
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self', 'args', 'kw')
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, acquired_property,
portal_type=None, storage_id=None, default=None):
......@@ -175,10 +175,10 @@ class Setter(Base.Setter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self', 'value', 'args', 'kw')
func_code.co_argcount = 2
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self', 'value', 'args', 'kw')
__code__.co_argcount = 2
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, acquired_property,
portal_type=None, storage_id=None):
......@@ -237,10 +237,10 @@ class ListGetter(Base.Getter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, acquired_property,
portal_type=None, storage_id=None):
......@@ -275,10 +275,10 @@ class Tester(Method):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, acquired_property,
portal_type=None, storage_id=None):
......
......@@ -47,10 +47,10 @@ class DefaultSetter(Base.Setter):
# Generic Definition of Method Object
# This is required to call the method form the Web
# More information at http://www.zope.org/Members/htrd/howto/FunctionTemplate
func_code = func_code()
func_code.co_varnames = ('self','value')
func_code.co_argcount = 2
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self','value')
__code__.co_argcount = 2
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, storage_id=None):
self._id = id
......@@ -111,10 +111,10 @@ class SetSetter(Base.Setter):
# Generic Definition of Method Object
# This is required to call the method form the Web
# More information at http://www.zope.org/Members/htrd/howto/FunctionTemplate
func_code = func_code()
func_code.co_varnames = ('self','value')
func_code.co_argcount = 2
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self','value')
__code__.co_argcount = 2
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, storage_id=None):
self._id = id
......@@ -166,10 +166,10 @@ class DefaultGetter(Base.Getter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, default=None, storage_id=None):
self._id = id
......@@ -219,10 +219,10 @@ class ListGetter(Base.Getter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
_list_type_list = tuple, list, set
......
......@@ -41,10 +41,10 @@ class DefaultGetter(BaseGetter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self', )
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self', )
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, warning=0):
self._id = id
......@@ -76,10 +76,10 @@ class ListGetter(BaseGetter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self', )
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self', )
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, warning=0):
self._id = id
......
......@@ -41,10 +41,10 @@ class DefaultGetter(BaseGetter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self', )
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self', )
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, warning=0):
"""
......@@ -83,10 +83,10 @@ class ListGetter(BaseGetter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self', )
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self', )
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, warning=0):
"""
......@@ -123,10 +123,10 @@ class DefaultPropertyGetter(BaseGetter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self', )
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self', )
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, warning=0):
self._id = id
......@@ -160,10 +160,10 @@ class PropertyListGetter(BaseGetter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self', )
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self', )
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, warning=0):
self._id = id
......
......@@ -43,10 +43,10 @@ class TranslatedPropertyGetter(BaseGetter):
Get the translated property
"""
# This can be called from the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_id, property_type, language, default=None, warning=0):
self._id = id
......@@ -99,10 +99,10 @@ class PropertyTranslationDomainGetter(BaseGetter):
_need__name__=1
# This can be called from the Web
func_code = func_code()
func_code.co_varnames = ('self', )
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self', )
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_type, default=None, storage_id=None):
self._id = id
......@@ -160,10 +160,10 @@ class TranslationPropertySetter(Accessor.Accessor):
# Generic Definition of Method Object
# This is required to call the method form the Web
# More information at http://www.zope.org/Members/htrd/howto/FunctionTemplate
func_code = func_code()
func_code.co_varnames = ('self', 'value')
func_code.co_argcount = 2
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self', 'value')
__code__.co_argcount = 2
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_id, property_type, language):
self._id = id
......@@ -223,10 +223,10 @@ class TranslatedPropertyTester(Method):
_need__name__=1
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, property_id, property_type, language, warning=0):
self._id = id
......
......@@ -109,10 +109,10 @@ class DefaultGetter(BaseGetter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self', 'args', 'kw' )
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self', 'args', 'kw' )
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, warning=0):
self._id = id
......@@ -140,10 +140,10 @@ class ListGetter(BaseGetter):
# Generic Definition of Method Object
# This is required to call the method form the Web
# XXX This does not work yet completely in URL mode
func_code = func_code()
func_code.co_varnames = ('self', 'args', 'kw' )
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self', 'args', 'kw' )
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key, warning=0):
self._id = id
......
......@@ -44,10 +44,10 @@ class Getter(BaseGetter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key):
self._id = id
......@@ -69,10 +69,10 @@ class TitleGetter(BaseGetter):
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code = func_code()
func_code.co_varnames = ('self',)
func_code.co_argcount = 1
func_defaults = ()
__code__ = func_code = func_code()
__code__.co_varnames = ('self',)
__code__.co_argcount = 1
__defaults__ = func_defaults = ()
def __init__(self, id, key):
self._id = id
......
......@@ -71,8 +71,8 @@ class InteractorMethod(Method):
self.after_action_list = []
self.before_action_list = []
self.method = method
self.func_code = method.func_code
self.func_defaults = method.func_defaults
self.__code__ = self.func_code = method.__code__
self.__defaults__ = self.func_defaults = method.__defaults__
self.__name__ = method.__name__
def registerBeforeAction(self, action, args, kw):
......
......@@ -24,7 +24,7 @@ class _(PatchClass(ExternalMethod)):
reloadIfChanged = getFuncDefaults = getFuncCode = filepath = None
@property
def func_defaults(self):
def __defaults__(self):
"""Return a tuple of default values.
The first value is for the "second" parameter (self is ommited)
......@@ -33,10 +33,12 @@ class _(PatchClass(ExternalMethod)):
will have func_defaults = ('', )
"""
return self._getFunction()[1]
func_defaults = __defaults__
@property
def func_code(self):
def __code__(self):
return self._getFunction()[2]
func_code = __code__
@property
def func_args(self):
......
......@@ -1639,7 +1639,9 @@ def optimize():
# Delay the compilations of Python Scripts until they are really executed.
# Python Scripts are exported without those 2 attributes:
PythonScript.func_code = lazy_func_prop('func_code', None)
PythonScript.__code__ = lazy_func_prop('__code__', None)
PythonScript.func_defaults = lazy_func_prop('func_defaults', None)
PythonScript.__defaults__ = lazy_func_prop('__defaults__', None)
def _compile(self):
if immediate_compilation:
......
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