From 7a7d99e0c83b3dda0f219be94c7ff543ca76b001 Mon Sep 17 00:00:00 2001 From: KiraPC Date: Tue, 22 Feb 2022 09:06:18 +0100 Subject: [PATCH] added multi parents inheritance --- fastapi_router_controller/lib/controller.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fastapi_router_controller/lib/controller.py b/fastapi_router_controller/lib/controller.py index 1c80283..8daa24c 100644 --- a/fastapi_router_controller/lib/controller.py +++ b/fastapi_router_controller/lib/controller.py @@ -89,8 +89,9 @@ def add_resource(self, cls): raise MultipleResourceException() # check if cls (Resource) was exteded from another - if hasattr(cls, Controller.RC_KEY): - self.__get_parent_routes(cls.__router__) + for base in cls.__bases__: + if hasattr(base, Controller.RC_KEY): + self.__get_parent_routes(base.__router__) setattr(cls, Controller.RC_KEY, self.router) setattr(self, Controller.RESOURCE_CLASS_KEY, cls)