diff options
author | Michael DeHaan <mdehaan@mdehaan.rdu.redhat.com> | 2007-06-12 15:56:03 -0400 |
---|---|---|
committer | Michael DeHaan <mdehaan@mdehaan.rdu.redhat.com> | 2007-06-12 15:56:03 -0400 |
commit | 0b8502cd2209b809ed8b98d8bab0086e169c4a0f (patch) | |
tree | e9419c253c094fd99fc6617b827cd8b2b048116d /cobbler/item.py | |
parent | 297f85a192483a61d921a35b6f7938d3c52e466f (diff) | |
download | third_party-cobbler-0b8502cd2209b809ed8b98d8bab0086e169c4a0f.tar.gz third_party-cobbler-0b8502cd2209b809ed8b98d8bab0086e169c4a0f.tar.xz third_party-cobbler-0b8502cd2209b809ed8b98d8bab0086e169c4a0f.zip |
Add conceptual_parent concept, to allow tree retrieval of objects that may have
intermediate subobjects of the same type in the way.
For instance, the conceptual parent of a subprofile is not the parent profile,
but is the distro object.
Also fixing a bug in is_pxe_supported()
Diffstat (limited to 'cobbler/item.py')
-rw-r--r-- | cobbler/item.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cobbler/item.py b/cobbler/item.py index f746491..b1ad2d1 100644 --- a/cobbler/item.py +++ b/cobbler/item.py @@ -66,6 +66,22 @@ class Item(serializable.Serializable): """ return None + def get_conceptual_parent(self): + """ + The parent may just be a superclass for something like a + subprofile. Get the first parent of a different type. + """ + # FIXME: this is a workaround to get the type of an instance var + # what's a more clean way to do this that's python 2.3 friendly? + # this returns something like: cobbler.item_system.System + mtype = str(self).split(" ")[0][1:] + parent = self.get_parent() + while parent is not None: + ptype = str(parent).split(" ")[0][1:] + if mtype != ptype: + return parent + return None + def set_name(self,name): """ All objects have names, and with the exception of System |