From 2da479f43bfd6d1baccab43dbd8c94511e0cea84 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Mon, 2 Apr 2007 10:50:18 +0200 Subject: [PATCH] [svn] fixed bug in replace filter discovered by ronny --HG-- branch : trunk --- jinja/filters.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) -- 2.26.2