home · contact · privacy
Minor typing fix.
authorChristian Heller <c.heller@plomlompom.de>
Fri, 2 Aug 2024 09:30:30 +0000 (11:30 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 2 Aug 2024 09:30:30 +0000 (11:30 +0200)
plomtask/db.py

index dc61f1a3c01d32595f4701a86295cff9d7a046fb..ee5f3b99f04e66460ef4e0a90c5d10d600210881 100644 (file)
@@ -340,7 +340,8 @@ class BaseModel(Generic[BaseModelId]):
     def __getattribute__(self, name: str) -> Any:
         """Ensure fail if ._disappear() was called, except to check ._exists"""
         if name != '_exists' and not super().__getattribute__('_exists'):
-            raise HandledException('Object does not exist.')
+            msg = f'Object for attribute does not exist: {name}'
+            raise HandledException(msg)
         return super().__getattribute__(name)
 
     def _disappear(self) -> None:
@@ -365,10 +366,11 @@ class BaseModel(Generic[BaseModelId]):
         cls.cache_ = {}
 
     @classmethod
-    def get_cache(cls: type[BaseModelInstance]) -> dict[Any, BaseModel[Any]]:
+    def get_cache(cls: type[BaseModelInstance]
+                  ) -> dict[Any, BaseModelInstance]:
         """Get cache dictionary, create it if not yet existing."""
         if not hasattr(cls, 'cache_'):
-            d: dict[Any, BaseModel[Any]] = {}
+            d: dict[Any, BaseModelInstance] = {}
             cls.cache_ = d
         return cls.cache_