Skip to content

Commit

Permalink
handle initialized (#5198)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximlt authored Jul 5, 2023
1 parent c998066 commit eb12414
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions panel/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit eb12414

Please sign in to comment.