--- a/src/pyams_utils/inherit.py Wed May 09 14:04:21 2018 +0200
+++ b/src/pyams_utils/inherit.py Wed May 09 14:05:08 2018 +0200
@@ -61,6 +61,15 @@
def no_inherit(self, value):
self.inherit = not bool(value)
+ @property
+ def inherit_from(self):
+ if not self.inherit:
+ return self
+ parent = self.parent
+ while self.adapted_interface(parent).inherit:
+ parent = parent.parent
+ return parent
+
class InheritedFieldProperty(object):
"""Inherited field property"""
--- a/src/pyams_utils/interfaces/inherit.py Wed May 09 14:04:21 2018 +0200
+++ b/src/pyams_utils/interfaces/inherit.py Wed May 09 14:05:08 2018 +0200
@@ -41,3 +41,5 @@
no_inherit = Bool(title=_("Don't inherit from parent?"),
required=False,
default=False)
+
+ inherit_from = Attribute("Parent from which adapted interface is inherited")