lavr / python-emails

Modern python library for emails
http://python-emails.readthedocs.org
Other
400 stars 54 forks source link

Can not change default output method in transformer #79

Closed positiveviking closed 7 years ago

positiveviking commented 7 years ago

In emails.transformer.HTMLParser default value of output_method parameter can not be changed from inherited class constructors.

When we use default output_method='xml' there are following issue with empty tags: Input data: <span></span>123

Expect after loading: <html><head></head><body><span></span>123</body></html>

Actual after loading: <html><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/></head><body><span/>123</body></html>

And browsers render this like <html><head></head><body><span>123</span></body></html>

Code for proof:

import emails.loader
emails.loader.from_html('<html><head></head><body><span></span>123</body></html>').html
positiveviking commented 7 years ago

PS output_method='html' fixes this issue.