From 6c529c121c3dfa78f516204fc62f1f93892ebf43 Mon Sep 17 00:00:00 2001 From: kreyoo Date: Thu, 18 Nov 2021 21:12:11 +0100 Subject: [PATCH] Make html element iterable --- src/mixt/internal/html.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/mixt/internal/html.py b/src/mixt/internal/html.py index 11c3af6..48092f0 100644 --- a/src/mixt/internal/html.py +++ b/src/mixt/internal/html.py @@ -207,6 +207,14 @@ def __repr__(self) -> str: (' class="{}"'.format(classes)) if classes else "", ) + def __iter__(self): + """ + Yields chars of the stringified html element + + With this you can easily use mixt for a flask response + """ + yield from str(self) + class HtmlElement(HtmlBaseElement): """Base for all HTML tags accepting children."""