projects
/
jinja2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6fa4ae7
)
[svn] fixed bug in replace filter discovered by ronny
author
Armin Ronacher
<armin.ronacher@active-4.com>
Mon, 2 Apr 2007 08:50:18 +0000
(10:50 +0200)
committer
Armin Ronacher
<armin.ronacher@active-4.com>
Mon, 2 Apr 2007 08:50:18 +0000
(10:50 +0200)
--HG--
branch : trunk
jinja/filters.py
patch
|
blob
|
history
diff --git
a/jinja/filters.py
b/jinja/filters.py
index 4cb2661ef37d4c6a96ad18688c28e6a3c19109a1..197dd3eab3c0f612a2ff1f73152978e32837b1ba 100644
(file)
--- 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)