diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2010-08-13 00:54:23 +0200 |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2010-08-13 00:54:23 +0200 |
commit | 3051422b114d4292fef31c1e2660498c5b7d2353 (patch) | |
tree | 77b3c2691252c0f8ca583cc4666d7844c6506fce /README.rst | |
parent | 4fa38b6fb0923789b2a9e6c7f980687c1725384d (diff) | |
download | markupsafe-3051422b114d4292fef31c1e2660498c5b7d2353.tar.gz |
MarkupSafe now provides a escape_silent method as well.
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -31,3 +31,18 @@ the `__html__` function: Markup(u'<strong>Nice</strong>') >>> Markup(Foo()) Markup(u'<strong>Nice</strong>') + +Since MarkupSafe 0.10 there is now also a separate escape function +called `escape_silent` that returns an empty string for `None` for +consistency with other systems that return empty strings for `None` +when escaping (for instance Pylons' webhelpers). + +If you also want to use this for the escape method of the Markup +object, you can create your own subclass that does that:: + + from markupsafe import Markup, escape_silent as escape + + class SilentMarkup(Markup): + @classmethod + def escape(cls, s): + return cls(escape(s)) |