From 094ee97f4d425774fcae7d1db33ed26880c189f8 Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 29 May 2019 22:46:05 +0100 Subject: [PATCH] Return 0 for penguin string attribute if attribute is None --- houdini/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/houdini/__init__.py b/houdini/__init__.py index 33f2900..6638b5c 100644 --- a/houdini/__init__.py +++ b/houdini/__init__.py @@ -44,13 +44,13 @@ class PenguinStringCompiler(OrderedDict): @classmethod def attribute_by_name(cls, attribute_name): async def attribute_method(p): - return getattr(p, attribute_name) + return getattr(p, attribute_name) or 0 return attribute_method @classmethod def data_attribute_by_name(cls, attribute_name): async def attribute_method(p): - return getattr(p.data, attribute_name) + return getattr(p.data, attribute_name) or 0 return attribute_method @classmethod