Reputation: 39
How can you, in a safe way, enter (en render) hmtl tags in a web2py database textfield. Entered by an end user?
Upvotes: 0
Views: 199
Reputation: 25536
You can save the HTML in the database as you receive it, and then render it (relatively) safely via:
{{=XML(html, sanitize=True)}}
XML() also takes permitted_tags and allowed_attributes arguments for more fine-grained control. For details, see the book.
XML()
permitted_tags
allowed_attributes
Upvotes: 2