Commit 060d27a4 authored by Jérome Perrin's avatar Jérome Perrin

*: prevent DeprecationWarning with inspect.getargspec

parent e5a7c9df
......@@ -440,7 +440,11 @@ def fill_args_from_request(*optional_args):
required by the method.
"""
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']
del names[:2]
names += optional_args
......
......@@ -241,7 +241,10 @@ from ZODB.ExportImport import TemporaryFile, export_end_marker
from ZODB.utils import p64
from ZODB.utils import u64
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 . import ppml
......@@ -328,7 +331,7 @@ def exportXML(jar, oid, file=None):
# can have values that have a shorter representation in 'repr' instead of
# 'base64' (see ppml.convert) and ppml.String does not support this.
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='')
pickle_dict = {oid: None}
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.
In ERP5, we have Activity Tool to postpone mail delivery.
"""
from inspect import getargspec, isfunction
from Products.MailHost.MailHost import MailBase
from inspect import isfunction
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__):
if isfunction(f):
args, _, _, defaults = getargspec(f)
argspec = getfullargspec(f)
args = argspec.args
defaults = argspec.defaults
try:
i = args.index('immediate') - len(args)
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