Implement Size.__radd__ so sum works with Size instances.
---
pyanaconda/storage/size.py | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/pyanaconda/storage/size.py b/pyanaconda/storage/size.py
index 865634c..1906ee0 100644
--- a/pyanaconda/storage/size.py
+++ b/pyanaconda/storage/size.py
@@ -148,6 +148,10 @@ class Size(Decimal):
def __add__(self, other):
return Size(bytes=Decimal.__add__(self, other))
+ # needed to make sum() work with Size arguments
+ def __radd__(self, other):
+ return Size(bytes=Decimal.__radd__(self, other))
+
def __sub__(self, other):
return Size(bytes=Decimal.__sub__(self, other))
--
1.7.7.6
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
|