Jinja

python template engine


Ticket #367 (closed defect: fixed)

Opened 6 weeks ago

Last modified 6 weeks ago

round filter returns an float when precision=0

Reported by: davedash Owned by: mitsuhiko
Priority: minor Milestone:
Component: filters Version:
Keywords: Cc: clouserw@…

Description

The expected (and documented) behavior is that you get an integer.

I looked at the tests and not only are the tests wrong, but they do a return rather than an assert.

This patch runs int() over the value returned if precision is zero.

Attachments

jinja2.patch (1.0 kB) - added by davedash 6 weeks ago.
Patch to deal with precision=0

Change History

Changed 6 weeks ago by davedash

Patch to deal with precision=0

Changed 6 weeks ago by clouserw

  • cc clouserw@… added

Changed 6 weeks ago by mitsuhiko

  • status changed from new to closed
  • resolution set to fixed

The float is intentional for consistency with the Python round() builtin. Documentation was updated appropriately. If you need an integer, pipe through int.

Note: See TracTickets for help on using tickets.