From eb12414c9de7502ea3d247e4f03b3b6c23830c8c Mon Sep 17 00:00:00 2001 From: Maxime Liquet <35924738+maximlt@users.noreply.github.com> Date: Wed, 5 Jul 2023 18:14:25 +0200 Subject: [PATCH] handle initialized (#5198) --- panel/config.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/panel/config.py b/panel/config.py index 0fef4e6ebb..8978d5aba0 100644 --- a/panel/config.py +++ b/panel/config.py @@ -351,7 +351,13 @@ def set(self, **kwargs): def __setattr__(self, attr, value): from .io.state import state - if not getattr(self, 'initialized', False) or (attr.startswith('_') and attr.endswith('_')) or attr == '_validating': + + # _param__private added in Param 2 + if hasattr(self, '_param__private'): + init = getattr(self._param__private, 'initialized', False) + else: + init = getattr(self, 'initialized', False) + if not init or (attr.startswith('_') and attr.endswith('_')) or attr == '_validating': return super().__setattr__(attr, value) value = getattr(self, f'_{attr}_hook', lambda x: x)(value) if attr in self._globals: @@ -389,7 +395,12 @@ def __getattribute__(self, attr): end up being modified. """ from .io.state import state - init = super().__getattribute__('initialized') + + # _param__private added in Param 2 + try: + init = super().__getattribute__('_param__private').initialized + except AttributeError: + init = super().__getattribute__('initialized') global_params = super().__getattribute__('_globals') if init and not attr.startswith('__'): params = super().__getattribute__('param')