From: Christian Heller Date: Thu, 14 Aug 2025 16:36:30 +0000 (+0200) Subject: Fix stumbling over banned .__setattr__ in ClientDb's own methods. X-Git-Url: https://plomlompom.com/repos/booking/do_day?a=commitdiff_plain;h=518d15c3d1a3ae7d99725d559c21afab2c417b0f;p=ircplom Fix stumbling over banned .__setattr__ in ClientDb's own methods. --- diff --git a/ircplom/client.py b/ircplom/client.py index 1cd66ac..dde5872 100644 --- a/ircplom/client.py +++ b/ircplom/client.py @@ -175,7 +175,7 @@ class IrcConnSetup(NamedTuple): class ClientDbBase: - 'Optimized for dealing with variable confirmation of values.' + 'For values of variable confirmation, and reading in multi-line lists.' client_host: str isupports: list[str] motd: list[str] @@ -192,8 +192,12 @@ class ClientDbBase: return value return None - def __setattr__(self, key: str, value) -> None: - raise CrashingException('no direct attribute setting, use .set() etc.') + def __setattr__(self, key: str, *args, **kwargs) -> None: + if key[:1] == '_': + super().__setattr__(key, *args, **kwargs) + else: + raise CrashingException( + 'no direct attribute setting, use .set() etc.') @classmethod def _type_for(cls, key):