Merge "Handle deprecation of inspect.getargspec"

This commit is contained in:
Zuul 2019-09-10 12:31:20 +00:00 committed by Gerrit Code Review
commit 6153e0fb52
1 changed files with 10 additions and 1 deletions

View File

@ -54,6 +54,15 @@ PALETTE = termcolors.PALETTES[termcolors.DEFAULT_PALETTE]
STRING_SEPARATOR = "__" STRING_SEPARATOR = "__"
# 'getfullargspec' is Python 3-only, but 'getargspec' is deprecated for removal
# in Python 3.6
# TODO(stephenfin): Remove 'getargspec' when we drop support for Python 2.7
if hasattr(inspect, 'getfullargspec'):
getargspec = inspect.getfullargspec
else:
getargspec = inspect.getargspec
@six.python_2_unicode_compatible @six.python_2_unicode_compatible
class Column(html.HTMLElement): class Column(html.HTMLElement):
"""A class which represents a single column in a :class:`.DataTable`. """A class which represents a single column in a :class:`.DataTable`.
@ -470,7 +479,7 @@ class Column(html.HTMLElement):
return None return None
obj_id = self.table.get_object_id(datum) obj_id = self.table.get_object_id(datum)
if callable(self.link): if callable(self.link):
if 'request' in inspect.getargspec(self.link).args: if 'request' in getargspec(self.link).args:
return self.link(datum, request=self.table.request) return self.link(datum, request=self.table.request)
return self.link(datum) return self.link(datum)
try: try: