]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
Merge branch '2.11.x'
authorDavid Lord <davidism@gmail.com>
Thu, 27 Feb 2020 19:16:01 +0000 (11:16 -0800)
committerDavid Lord <davidism@gmail.com>
Thu, 27 Feb 2020 19:16:01 +0000 (11:16 -0800)
1  2 
CHANGES.rst
docs/api.rst
src/jinja2/filters.py
tests/test_filters.py

diff --cc CHANGES.rst
index 20358b6fedc2c7bd3d2fcbc2e2256c7bb5ed3ee2,9635fc5588264b9276d3e389b5c53843a7b0cb50..e7542118da84ef54eb5ab1deff4c652ce8393ade
@@@ -19,7 -8,9 +19,8 @@@ Unrelease
  -   Fix a bug that caused callable objects with ``__getattr__``, like
      :class:`~unittest.mock.Mock` to be treated as a
      :func:`contextfunction`. :issue:`1145`
+ -   Update ``wordcount`` filter to trigger :class:`Undefined` methods
 -    by wrapping the input in :func:`soft_unicode`. :pr:`1160`
 -
++    by wrapping the input in :func:`soft_str`. :pr:`1160`
  
  Version 2.11.1
  --------------
diff --cc docs/api.rst
Simple merge
index f39d389fd723e8852280bfa6ee0fe2600cbbbfdd,974156735123b88ed996997cf18e2db03bc3c7be..c257d4c5fc27db297b84ca907f7115d25f1eab9f
@@@ -741,7 -761,7 +741,7 @@@ def do_wordwrap
  
  def do_wordcount(s):
      """Count the words in that string."""
-     return len(_word_re.findall(s))
 -    return len(_word_re.findall(soft_unicode(s)))
++    return len(_word_re.findall(soft_str(s)))
  
  
  def do_int(value, default=0, base=10):
index ab6e93d41c6f51b71e45473c93fecd3c789e6cd6,388c346212ee1a5db15b8403c2afa278cb5690e0..8087a248148a8c25c7bdcb3e36491c584ad7813d
@@@ -5,9 -6,14 +5,11 @@@ import pytes
  
  from jinja2 import Environment
  from jinja2 import Markup
 -from jinja2._compat import implements_to_string
 -from jinja2._compat import text_type
+ from jinja2 import StrictUndefined
+ from jinja2 import UndefinedError
  
  
 -@implements_to_string
 -class Magic(object):
 +class Magic:
      def __init__(self, value):
          self.value = value