From 0b5ca90435332930af00c813e9122f1afa79ceb2 Mon Sep 17 00:00:00 2001 From: Capocchi Date: Sat, 9 Sep 2023 09:38:27 +0200 Subject: [PATCH 1/2] bug fix --- Utilities.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Utilities.py b/Utilities.py index 8f80f616..5bf90d76 100644 --- a/Utilities.py +++ b/Utilities.py @@ -32,8 +32,9 @@ import configparser import tempfile import pathlib - +import types import inspect + if not hasattr(inspect, 'getargspec'): inspect.getargspec = inspect.getfullargspec From 4987c59c39281dd94725430108730a026381a81c Mon Sep 17 00:00:00 2001 From: Capocchi Date: Thu, 14 Sep 2023 18:15:51 +0200 Subject: [PATCH 2/2] try to catch and resolve instanciation of unknown class --- Components.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Components.py b/Components.py index d42b1545..dca7af04 100644 --- a/Components.py +++ b/Components.py @@ -104,7 +104,17 @@ def GetClass(elem): cls = next(filter(lambda c: c not in DomainClass and issubclass(c, DomainClass) and c.__name__ in elem, clsmembers.values()), None) - if not cls: sys.stderr.write(_("Class unknown...")) + if not cls: + sys.stderr.write(_("\nClass name and model name are different!\nWe try to instance the class %s that inherite of DomainClass!"%elem)) + cls = next(filter(lambda c: c not in DomainClass and issubclass(c, DomainClass), clsmembers.values()), None) + if cls: + sys.stderr.write(_("\nClass instanciated but you need to verify if its a good one!\n")) + if not cls: + + sys.stderr.write(_("\nClass unknown...")) + # sys.stderr.write(f"path: {elem} \n clsmembers:{clsmembers}\n") + # for c in clsmembers.values(): + # print(c.__name__, c not in DomainClass, issubclass(c, DomainClass), c.__name__ in elem) return cls