Fixed #367 by improving the documentation.
authorArmin Ronacher <armin.ronacher@active-4.com>
Sat, 6 Feb 2010 22:33:11 +0000 (23:33 +0100)
committerArmin Ronacher <armin.ronacher@active-4.com>
Sat, 6 Feb 2010 22:33:11 +0000 (23:33 +0100)
--HG--
branch : trunk

jinja2/filters.py

index 4b85c30812cc4be6a0bf3f0a6c4a4fb064e93187..3da422145ab549b2d262e90218846be9144cb8b5 100644 (file)
@@ -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')