Browse Source

Merge "Handle deprecation of inspect.getargspec"

tags/16.0.0.0b2
Zuul 1 week ago
parent
commit
6153e0fb52
1 changed files with 10 additions and 1 deletions
  1. 10
    1
      horizon/tables/base.py

+ 10
- 1
horizon/tables/base.py View File

@@ -54,6 +54,15 @@ PALETTE = termcolors.PALETTES[termcolors.DEFAULT_PALETTE]
54 54
 STRING_SEPARATOR = "__"
55 55
 
56 56
 
57
+# 'getfullargspec' is Python 3-only, but 'getargspec' is deprecated for removal
58
+# in Python 3.6
59
+# TODO(stephenfin): Remove 'getargspec' when we drop support for Python 2.7
60
+if hasattr(inspect, 'getfullargspec'):
61
+    getargspec = inspect.getfullargspec
62
+else:
63
+    getargspec = inspect.getargspec
64
+
65
+
57 66
 @six.python_2_unicode_compatible
58 67
 class Column(html.HTMLElement):
59 68
     """A class which represents a single column in a :class:`.DataTable`.
@@ -470,7 +479,7 @@ class Column(html.HTMLElement):
470 479
                 return None
471 480
         obj_id = self.table.get_object_id(datum)
472 481
         if callable(self.link):
473
-            if 'request' in inspect.getargspec(self.link).args:
482
+            if 'request' in getargspec(self.link).args:
474 483
                 return self.link(datum, request=self.table.request)
475 484
             return self.link(datum)
476 485
         try:

Loading…
Cancel
Save