Return 0 for penguin string attribute if attribute is None

This commit is contained in:
Ben 2019-05-29 22:46:05 +01:00
parent c5d2b6e03b
commit 094ee97f4d

View File

@ -44,13 +44,13 @@ class PenguinStringCompiler(OrderedDict):
@classmethod @classmethod
def attribute_by_name(cls, attribute_name): def attribute_by_name(cls, attribute_name):
async def attribute_method(p): async def attribute_method(p):
return getattr(p, attribute_name) return getattr(p, attribute_name) or 0
return attribute_method return attribute_method
@classmethod @classmethod
def data_attribute_by_name(cls, attribute_name): def data_attribute_by_name(cls, attribute_name):
async def attribute_method(p): async def attribute_method(p):
return getattr(p.data, attribute_name) return getattr(p.data, attribute_name) or 0
return attribute_method return attribute_method
@classmethod @classmethod