Commit 1d916974 authored by Jérome Perrin's avatar Jérome Perrin

*: prevent DeprecationWarning with inspect.getargspec

parent ebb18881
...@@ -440,7 +440,11 @@ def fill_args_from_request(*optional_args): ...@@ -440,7 +440,11 @@ def fill_args_from_request(*optional_args):
required by the method. required by the method.
""" """
def decorator(wrapped): def decorator(wrapped):
names = inspect.getargspec(wrapped)[0] if six.PY3:
getfullargspec = inspect.getfullargspec
else:
getfullargspec = inspect.getargspec
names = getfullargspec(wrapped)[0]
assert names[:2] == ['self', 'REQUEST'] assert names[:2] == ['self', 'REQUEST']
del names[:2] del names[:2]
names += optional_args names += optional_args
......
...@@ -241,7 +241,10 @@ from ZODB.ExportImport import TemporaryFile, export_end_marker ...@@ -241,7 +241,10 @@ from ZODB.ExportImport import TemporaryFile, export_end_marker
from ZODB.utils import p64 from ZODB.utils import p64
from ZODB.utils import u64 from ZODB.utils import u64
from functools import partial from functools import partial
from inspect import getargspec if six.PY2:
from inspect import getargspec as getfullargspec
else:
from inspect import getfullargspec
from OFS import ObjectManager from OFS import ObjectManager
from . import ppml from . import ppml
...@@ -328,7 +331,7 @@ def exportXML(jar, oid, file=None): ...@@ -328,7 +331,7 @@ def exportXML(jar, oid, file=None):
# can have values that have a shorter representation in 'repr' instead of # can have values that have a shorter representation in 'repr' instead of
# 'base64' (see ppml.convert) and ppml.String does not support this. # 'base64' (see ppml.convert) and ppml.String does not support this.
load = jar._storage.load load = jar._storage.load
if 'version' in getargspec(load).args: # BBB: ZODB<5 (TmpStore) if 'version' in getfullargspec(load).args: # BBB: ZODB<5 (TmpStore)
load = partial(load, version='') load = partial(load, version='')
pickle_dict = {oid: None} pickle_dict = {oid: None}
max_cache = [1e7] # do not cache more than 10MB of pickle data max_cache = [1e7] # do not cache more than 10MB of pickle data
......
...@@ -18,13 +18,20 @@ Change default behaviour of MailHost to send mails immediately. ...@@ -18,13 +18,20 @@ Change default behaviour of MailHost to send mails immediately.
In ERP5, we have Activity Tool to postpone mail delivery. In ERP5, we have Activity Tool to postpone mail delivery.
""" """
from inspect import getargspec, isfunction from inspect import isfunction
from Products.MailHost.MailHost import MailBase
import six import six
if six.PY3:
from inspect import getfullargspec
else:
from inspect import getargspec as getfullargspec
from Products.MailHost.MailHost import MailBase
for f in six.itervalues(MailBase.__dict__): for f in six.itervalues(MailBase.__dict__):
if isfunction(f): if isfunction(f):
args, _, _, defaults = getargspec(f) argspec = getfullargspec(f)
args = argspec.args
defaults = argspec.defaults
try: try:
i = args.index('immediate') - len(args) i = args.index('immediate') - len(args)
except ValueError: except ValueError:
......
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