projects
/
jinja2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7fd4ad6
)
Fixed #367 by improving the documentation.
author
Armin Ronacher
<armin.ronacher@active-4.com>
Sat, 6 Feb 2010 22:33:11 +0000
(23:33 +0100)
committer
Armin Ronacher
<armin.ronacher@active-4.com>
Sat, 6 Feb 2010 22:33:11 +0000
(23:33 +0100)
--HG--
branch : trunk
jinja2/filters.py
patch
|
blob
|
history
diff --git
a/jinja2/filters.py
b/jinja2/filters.py
index 4b85c30812cc4be6a0bf3f0a6c4a4fb064e93187..3da422145ab549b2d262e90218846be9144cb8b5 100644
(file)
--- a/
jinja2/filters.py
+++ b/
jinja2/filters.py
@@
-531,9
+531,17
@@
def do_round(value, precision=0, method='common'):
.. sourcecode:: jinja
{{ 42.55|round }}
- -> 43
+ -> 43
.0
{{ 42.55|round(1, 'floor') }}
-> 42.5
+
+ Note that even if rounded to 0 precision, a float is returned. If
+ you need a real integer, pipe it through `int`:
+
+ .. sourcecode:: jinja
+
+ {{ 42.55|round|int }}
+ -> 43
"""
if not method in ('common', 'ceil', 'floor'):
raise FilterArgumentError('method must be common, ceil or floor')