Jinja

python template engine


Ticket #367 (closed defect: fixed)

Opened 7 months ago

Last modified 7 months 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 7 months ago.
Patch to deal with precision=0

Change History

Changed 7 months ago by davedash

Patch to deal with precision=0

Changed 7 months ago by clouserw

  • cc clouserw@… added

Changed 7 months 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.