Look for _get_parent_attribute method in both src and dst dict

When determining which getter style to use for the object in question,
the BaseMeta class should look at both dict's to try and locate the method.

Fixes #18522
This commit is contained in:
James Cammarata 2016-11-23 12:21:14 -06:00
parent 4a325b5ea2
commit 4859e0a419

View file

@ -111,7 +111,7 @@ class BaseMeta(type):
method = "_get_attr_%s" % attr_name method = "_get_attr_%s" % attr_name
if method in src_dict or method in dst_dict: if method in src_dict or method in dst_dict:
getter = partial(_generic_g_method, attr_name) getter = partial(_generic_g_method, attr_name)
elif '_get_parent_attribute' in dst_dict and value.inherit: elif ('_get_parent_attribute' in dst_dict or '_get_parent_attribute' in src_dict) and value.inherit:
getter = partial(_generic_g_parent, attr_name) getter = partial(_generic_g_parent, attr_name)
else: else:
getter = partial(_generic_g, attr_name) getter = partial(_generic_g, attr_name)