Skip to content

Commit a61037d

Browse files
committed
While a str is Iterable, it is not a list. Wrap it up
1 parent 5f4dd41 commit a61037d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

htmltools/_core.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,10 @@ def extend(self, other: Iterable[TagChild]) -> None:
279279
Extend the children by appending an iterable of children.
280280
"""
281281

282+
# If other is a string (an iterable), convert it to a list of s.
283+
if isinstance(other, str):
284+
other = [other]
285+
282286
super().extend(_tagchilds_to_tagnodes(other))
283287

284288
def append(self, item: TagChild, *args: TagChild) -> None:

0 commit comments

Comments
 (0)