commit | 9a027f4bca58520f0c258bfdc46961a3c269188c | [log] [tgz] |
---|---|---|
author | Armin Ronacher <armin.ronacher@active-4.com> | Thu Apr 17 11:13:40 2008 +0200 |
committer | Armin Ronacher <armin.ronacher@active-4.com> | Thu Apr 17 11:13:40 2008 +0200 |
tree | cbbbfe2a3c32b8ecec8df1d85d384db584066b85 | |
parent | 18c6ca0e4d30da530bf482673899fddda275de2a [diff] [blame] |
improved filters --HG-- branch : trunk
diff --git a/jinja2/utils.py b/jinja2/utils.py index af1066c..2e64fe2 100644 --- a/jinja2/utils.py +++ b/jinja2/utils.py
@@ -26,6 +26,15 @@ ) +def soft_unicode(s): + """Make a string unicode if it isn't already. That way a markup + string is not converted back to unicode. + """ + if not isinstance(s, unicode): + s = unicode(s) + return s + + def pformat(obj, verbose=False): """ Prettyprint an object. Either use the `pretty` library or the