From 705b93890c244e53326245b3b1709ba84e9a8c80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20=C5=A0milauer?= Date: Tue, 26 Nov 2024 12:33:56 +0100 Subject: [PATCH] (format fix) --- mupifDB/api/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mupifDB/api/main.py b/mupifDB/api/main.py index bd02884..4c0edb6 100644 --- a/mupifDB/api/main.py +++ b/mupifDB/api/main.py @@ -93,8 +93,9 @@ def has(self, obj: Any, perm: _PermWhat='read', on: _PermOn='self') -> bool: return True def ensure(self, obj: T, perm:_PermWhat='read', on: _PermOn='self',diag: str|None=None) -> T: 'Check permissions on the object (read on obj by default) and return it. Raise ForbiddenError if the check fails.' + # if obj.parent is None: raise ForbiddenError(f'{obj.__class__.__name__}(dbID={obj.dbID}).parent is None!') if not self.has(obj=obj,perm=perm, on=on): - raise ForbiddenError('Forbidden {perm} access to {"the parent of" if on=="parent" else ""} {obj.__class__.__name__}(dbID={obj.dbID}){": "+diag if diag else ""}.') + raise ForbiddenError(f'Forbidden {perm} access to {"the parent of" if on=="parent" else ""} {obj.__class__.__name__}(dbID={obj.dbID}){": "+diag if diag else ""}.') return obj def TODO(*args,**kw): pass def filterSelfRead(self,objs: List[T]) -> List[T]: return [obj for obj in objs if self.has(obj,perm='read',on='self')]