diff options
author | David Lehman <dlehman@redhat.com> | 2012-07-27 18:45:36 -0500 |
---|---|---|
committer | David Lehman <dlehman@redhat.com> | 2012-08-13 11:54:04 -0500 |
commit | 1b14e2d813b2b473a082a1c82cbf1537f8d7a1fe (patch) | |
tree | 7835b79d2427d716139edd6ae8bb37f30983929b | |
parent | 2761d6e353d891478555d10ed41c6510d1c8e05f (diff) | |
download | anaconda-1b14e2d813b2b473a082a1c82cbf1537f8d7a1fe.tar.gz anaconda-1b14e2d813b2b473a082a1c82cbf1537f8d7a1fe.tar.xz anaconda-1b14e2d813b2b473a082a1c82cbf1537f8d7a1fe.zip |
Fix subtraction for Size.
-rw-r--r-- | pyanaconda/storage/size.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/pyanaconda/storage/size.py b/pyanaconda/storage/size.py index eb3e2e4ff..75ea933e0 100644 --- a/pyanaconda/storage/size.py +++ b/pyanaconda/storage/size.py @@ -139,27 +139,29 @@ class Size(Decimal): return self - def __str__(self): + def __str__(self, context=None): return self.humanReadable() def __repr__(self): return "Size('%s')" % self - def __add__(self, other): - return Size(bytes=Decimal.__add__(self, other)) + def __add__(self, other, context=None): + return Size(bytes=Decimal.__add__(self, other, context=context)) # needed to make sum() work with Size arguments - def __radd__(self, other): - return Size(bytes=Decimal.__radd__(self, other)) + def __radd__(self, other, context=None): + return Size(bytes=Decimal.__radd__(self, other, context=context)) - def __sub__(self, other): - return Size(bytes=Decimal.__sub__(self, other)) + def __sub__(self, other, context=None): + # subtraction is implemented using __add__ and negation, so we'll + # be getting passed a Size + return Decimal.__sub__(self, other, context=context) - def __mul__(self, other): - return Size(bytes=Decimal.__mul__(self, other)) + def __mul__(self, other, context=None): + return Size(bytes=Decimal.__mul__(self, other, context=context)) - def __div__(self, other): - return Size(bytes=Decimal.__div__(self, other)) + def __div__(self, other, context=None): + return Size(bytes=Decimal.__div__(self, other, context=context)) def _trimEnd(self, val): """ Internal method to trim trailing zeros. """ |