Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Work around a regression in Python 3.3 for ``colander.Decimal`` whe…

…n it's

  used with a ``quant`` argument but without a ``rounding`` argument.
  See #66

- Add Python 3.3 to tox configuration and use newer tox testing regime
  (setup.py dev).

Closes #66
  • Loading branch information...
commit f180c6a19178dd40a5ff5668a4ee38796545560a 1 parent f8551dd
Chris McDonough mcdonc authored
Showing with 28 additions and 15 deletions.
  1. +16 −0 CHANGES.txt
  2. +9 −5 colander/__init__.py
  3. +3 −10 tox.ini
16 CHANGES.txt
View
@@ -1,3 +1,19 @@
+Next release
+------------
+
+Bug Fixes
+~~~~~~~~~
+
+- Work around a regression in Python 3.3 for ``colander.Decimal`` when it's
+ used with a ``quant`` argument but without a ``rounding`` argument.
+ See https://github.com/Pylons/colander/issues/66
+
+Features
+~~~~~~~~
+
+- Add Python 3.3 to tox configuration and use newer tox testing regime
+ (setup.py dev).
+
0.9.9 (2012-09-24)
------------------
14 colander/__init__.py
View
@@ -1086,10 +1086,11 @@ class Decimal(Number):
returned.
The Decimal constructor takes two optional arguments, ``quant`` and
- ``rounding``. If supplied, ``quant`` should be a string. If supplied,
- ``rounding`` should be one of the Python ``decimal`` module rounding
- options (e.g. ``decimal.ROUND_UP``, ``decimal.ROUND_DOWN``, etc). The
- serialized and deserialized result will be quantized and rounded via
+ ``rounding``. If supplied, ``quant`` should be a string,
+ (e.g. ``1.00``). If supplied, ``rounding`` should be one of the Python
+ ``decimal`` module rounding options (e.g. ``decimal.ROUND_UP``,
+ ``decimal.ROUND_DOWN``, etc). The serialized and deserialized result
+ will be quantized and rounded via
``result.quantize(decimal.Decimal(quant), rounding)``. ``rounding`` is
ignored if ``quant`` is not supplied.
@@ -1106,7 +1107,10 @@ def __init__(self, quant=None, rounding=None):
def num(self, val):
result = decimal.Decimal(str(val))
if self.quant is not None:
- result = result.quantize(self.quant, self.rounding)
+ if self.rounding is None:
+ result = result.quantize(self.quant)
+ else:
+ result = result.quantize(self.quant, self.rounding)
return result
class Money(Decimal):
13 tox.ini
View
@@ -1,10 +1,11 @@
[tox]
envlist =
- py26,py27,py32,pypy,cover
+ py26,py27,py32,py33,pypy,cover
[testenv]
commands =
- python setup.py test -q
+ python setup.py dev
+ python -Wd setup.py test -q
[testenv:cover]
basepython =
@@ -12,12 +13,4 @@ basepython =
commands =
python setup.py nosetests --with-xunit --with-xcoverage
deps =
- nose
- coverage==3.4
nosexcover
-
-# we separate coverage into its own testenv because a) "last run wins" wrt
-# cobertura jenkins reporting and b) pypy and jython can't handle any
-# combination of versions of coverage and nosexcover that i can find.
-# coverage==3.4 is required by nosexcover
-
Please sign in to comment.
Something went wrong with that request. Please try again.