From: Armin Ronacher Date: Mon, 2 Apr 2007 08:50:18 +0000 (+0200) Subject: [svn] fixed bug in replace filter discovered by ronny X-Git-Tag: 2.0rc1~376 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2da479f43bfd6d1baccab43dbd8c94511e0cea84;p=jinja2.git [svn] fixed bug in replace filter discovered by ronny --HG-- branch : trunk --- diff --git a/jinja/filters.py b/jinja/filters.py index 4cb2661..197dd3e 100644 --- a/jinja/filters.py +++ b/jinja/filters.py @@ -70,12 +70,12 @@ def do_replace(s, old, new, count=None): not isinstance(new, basestring): raise FilterArgumentError('the replace filter requires ' 'string replacement arguments') - elif not isinstance(count, (int, long)): + if count is None: + return s.replace(old, new) + if not isinstance(count, (int, long)): raise FilterArgumentError('the count parameter of the ' 'replace filter requires ' 'an integer') - if count is None: - return s.replace(old, new) return s.replace(old, new, count) do_replace = stringfilter(do_replace)