From 5aaadf1e50bb8ecff74d31b339b135db3f423d50 Mon Sep 17 00:00:00 2001 From: Dmitry Teselkin Date: Fri, 30 May 2014 14:55:10 +0400 Subject: [PATCH] Add default for getAttr Change-Id: Ia36eb5e92007d372504a372beadf197d0b7d01ff --- murano/dsl/principal_objects/sys_object.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/murano/dsl/principal_objects/sys_object.py b/murano/dsl/principal_objects/sys_object.py index 9fd9525f..e79f582d 100644 --- a/murano/dsl/principal_objects/sys_object.py +++ b/murano/dsl/principal_objects/sys_object.py @@ -27,11 +27,13 @@ class SysObject(object): attribute_store = helpers.get_attribute_store(_context) attribute_store.set(self, owner, name, value) - def getAttr(self, _context, name, owner=None): + def getAttr(self, _context, name, default=None, owner=None): if owner is None: owner = helpers.get_type(helpers.get_caller_context(_context)) if not isinstance(owner, murano_class.MuranoClass): raise TypeError() attribute_store = helpers.get_attribute_store(_context) - return attribute_store.get(self, owner, name) + + result = attribute_store.get(self, owner, name) + return default if result is None else result