Skip to content

Commit

Permalink
Remove need to append -
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Mar 5, 2021
1 parent ada9776 commit 006c138
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
11 changes: 6 additions & 5 deletions panel/models/reactive_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@ def handle_starttag(self, tags, attrs):
attrs = dict(attrs)
dom_id = attrs.pop('id', None)
self._current_node = None
if not dom_id or not dom_id.endswith('-${id}'):
if not dom_id:
return

name = '-'.join(dom_id.split('-')[:-1])
self._current_node = name
self.nodes.append(name)
if dom_id in self.nodes:
raise ValueError(f'Multiple DOM nodes with id="{dom_id}" found.')
self._current_node = dom_id
self.nodes.append(dom_id)
for attr, value in attrs.items():
if value is None:
continue
if self._template_re.match(value) and not value[2:-1].startswith('model.'):
self.attrs[name].append((attr, value[2:-1]))
self.attrs[dom_id].append((attr, value[2:-1]))

def handle_endtag(self, tag):
self._current_node = None
Expand Down
10 changes: 6 additions & 4 deletions panel/reactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,12 +977,14 @@ def _get_properties(self):
return {p : getattr(self, p) for p in list(Layoutable.param)
if getattr(self, p) is not None}

def _get_data_properties(self):
return {p : getattr(self, p) for p in list(self.param)
if p not in list(Reactive.param) and getattr(self, p) is not None}

def _get_children(self, doc, root, model, comm):
html = self._html
for attr in self._attrs:
html = (
html
.replace(f"id='{attr}'", f"id='{attr}-${{id}}'")
.replace(f'id="{attr}"', f'id="{attr}-${{id}}"')
)
children, child_models = {}, {}
for parent, child_name in self._parser.children.items():
child_panes = getattr(self, child_name)
Expand Down

0 comments on commit 006c138

Please sign in to comment.