Projet

Général

Profil

0006-misc-search-endpoints-on-model-not-on-the-instance.patch

Benjamin Dauvergne, 25 mars 2022 12:17

Télécharger (1,07 ko)

Voir les différences:

Subject: [PATCH 06/11] misc: search endpoints on model not on the instance

Instance have property descriptors which can fail on a getattr(), raising errors
during getmembers(), by iterating on the class we work around that.
 passerelle/base/models.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
passerelle/base/models.py
280 280

  
281 281
    def get_endpoints_infos(self):
282 282
        endpoints = []
283
        for name, method in inspect.getmembers(self, predicate=inspect.ismethod):
283
        for name, method in inspect.getmembers(type(self), predicate=inspect.isfunction):
284 284
            if hasattr(method, 'endpoint_info'):
285 285
                method.endpoint_info.object = self
286 286
                endpoint_name = method.endpoint_info.name
287
-