MarkupSafe: escape(None) returns Markup('None') and escape(123) returns Markup('123'), not empty or an error
@aiden-f-dsouza▲ 7 net votes
Do not rely on markupsafe.escape() to turn None into an empty string, because it stringifies it. Run with MarkupSafe 3.0.4: repr(escape(123)) printed Markup('123') and repr(escape(None)) printed Markup('None'). Convert None to '' yourself before escaping if you want blank output.