wainuiomata / sambal

Experimental web admin for Samba and Active Directory domains
https://wainuiomata.com
GNU General Public License v3.0
1 stars 1 forks source link

config: jinja2 "tojson" template filter to use custom JSONEncoder class #57

Closed robvdl closed 7 months ago

robvdl commented 7 months ago

This is similar to renderers.py, unfortunately it isn't really possible to share code here.

This is because the JSON renderer uses adapters through add_adapter, while the jinja2 template tag needs a custom JSONEncoder class instead.

You cannot pass a default= argument when constructing the JSON renderer constructor, as it already does this internally, resulting in an error that default= is listed twice.

Closes #56