Make sure getModifiedItemAttr always returns an int, unless otherwise wanting None

In py2, you could compare None to an int and it would always be less than. Unfortunately in py3, this is no longer the case. Returning getModifiedItemAttr as 0 allows us to not do a huge refactor.
This commit is contained in:
blitzmann
2017-11-04 18:20:00 -04:00
parent 56f34873a6
commit ce3b94696a
5 changed files with 9 additions and 8 deletions

View File

@@ -28,23 +28,23 @@ cappingAttrKeyCache = {}
class ItemAttrShortcut(object):
def getModifiedItemAttr(self, key, default=None):
def getModifiedItemAttr(self, key, default=0):
return_value = self.itemModifiedAttributes.get(key)
if return_value is None and default is not None:
return_value = default
return return_value
return return_value if default is not None else None
class ChargeAttrShortcut(object):
def getModifiedChargeAttr(self, key, default=None):
def getModifiedChargeAttr(self, key, default=0):
return_value = self.chargeModifiedAttributes.get(key)
if return_value is None and default is not None:
return_value = default
return return_value
return return_value if default is not None else None
class ModifiedAttributeDict(collections.MutableMapping):