misc: search endpoints on model not on the instance (#60836)

Instance have property descriptors which can fail on a getattr(), raising errors
during getmembers(), by iterating on the class we work around that.
This commit is contained in:
Benjamin Dauvergne 2022-03-25 12:11:25 +01:00
parent 1c5c7e5454
commit 498813542f
1 changed files with 1 additions and 1 deletions

View File

@ -279,7 +279,7 @@ class BaseResource(models.Model):
def get_endpoints_infos(self):
endpoints = []
for dummy, method in inspect.getmembers(self, predicate=inspect.ismethod):
for dummy, method in inspect.getmembers(type(self), predicate=inspect.isfunction):
if hasattr(method, 'endpoint_info'):
method.endpoint_info.object = self
endpoint_name = method.endpoint_info.name