Skip to content
This repository was archived by the owner on Jan 11, 2021. It is now read-only.

Commit 12cabd9

Browse files
committed
Compatibility with Python 3
1 parent 558678b commit 12cabd9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

rest_framework_swagger/introspectors.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -287,14 +287,14 @@ def __iter__(self):
287287
yield ViewSetMethodIntrospector(self, methods[method], method)
288288

289289
def _resolve_methods(self):
290-
if not hasattr(self.pattern.callback, 'func_code') or \
291-
not hasattr(self.pattern.callback, 'func_closure') or \
292-
not hasattr(self.pattern.callback.func_code, 'co_freevars') or \
293-
'actions' not in self.pattern.callback.func_code.co_freevars:
290+
if not hasattr(self.pattern.callback, '__code__') or \
291+
not hasattr(self.pattern.callback, '__closure__') or \
292+
not hasattr(self.pattern.callback.__code__, 'co_freevars') or \
293+
'actions' not in self.pattern.callback.__code__.co_freevars:
294294
raise RuntimeError('Unable to use callback invalid closure/function specified.')
295295

296-
idx = self.pattern.callback.func_code.co_freevars.index('actions')
297-
return self.pattern.callback.func_closure[idx].cell_contents
296+
idx = self.pattern.callback.__code__.co_freevars.index('actions')
297+
return self.pattern.callback.__closure__[idx].cell_contents
298298

299299

300300
class ViewSetMethodIntrospector(BaseMethodIntrospector):

0 commit comments

Comments
 (0)