From 04a17f6ac8f17415f28a4008aed6c549c12b63d7 Mon Sep 17 00:00:00 2001 From: robbe Date: Thu, 24 Apr 2025 13:07:32 +0200 Subject: [PATCH] has_slot(obj) now works on instance ipv class. Useful for optional field --- api/od.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/api/od.py b/api/od.py index b176abf..bd0e2b7 100644 --- a/api/od.py +++ b/api/od.py @@ -151,10 +151,9 @@ class ODAPI: self.bottom.delete_element(obj) self.__recompute_mappings() - # Does the class of the object have the given attribute? + # Does the the object have the given attribute? def has_slot(self, obj: UUID, attr_name: str): - class_name = self.get_name(self.get_type(obj)) - return self.od.get_attr_link_name(class_name, attr_name) != None + return self.od.get_slot_link(obj, attr_name) != None def get_slots(self, obj: UUID) -> list[str]: return [attr_name for attr_name, _ in self.od.get_slots(obj)]