Skip to content

Commit

Permalink
Merge branch 'parent-overwrite-on-reuse-fix' of https://github.com/rl…
Browse files Browse the repository at this point in the history
…-utility-man/branca into parent-overwrite-on-reuse-fix
  • Loading branch information
rl-utility-man committed Jan 21, 2025
2 parents fa67593 + 7b5b1bf commit 7d677c3
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions branca/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ def __init__(
elif template_name is not None:
self._template = ENV.get_template(template_name)




def __getstate__(self) -> dict:
"""Modify object state when pickling the object.
Expand Down Expand Up @@ -157,7 +154,7 @@ def add_child(
# replace the proposed child with a clone of the proposed child because
# add_child 1) overwrites any existing value in the child._parent field
# and 2) does not do anything to remove the child from the list of children of the prior parent
# leading to inconsistency and to problems like the fact that adding the same icon to a map twice fails, as
# leading to inconsistency and to problems like the fact that adding the same icon to a map twice fails, as
# documented in https://github.com/python-visualization/folium/issues/1885
# Creating a clone leads to internally consistent behavior if the
# child already has a parent, although existing code of the form:
Expand All @@ -170,7 +167,6 @@ def add_child(
print("Note: the branca add_child function cloned an element rather than overwrite its existing parent element. This is new behavior as of early 2025. If you got this after issuing a command like my_map.add_child(myElement) and plan to issue a subsequent command like myElement.change(), that subsequent command will not affect the clone. Try either issuing the myElement.change() command first or creating a fresh version of myElement with no parent.")
child = child.clone()


if name is None:
name = child.get_name()
if index is None:
Expand Down

0 comments on commit 7d677c3

Please sign in to comment.