pyramid.location¶
- lineage(resource)[source]¶
 Return a generator representing the lineage of the resource object implied by the
resourceargument. The generator first returnsresourceunconditionally. Then, ifresourcesupplies a__parent__attribute, return the resource represented byresource.__parent__. If that resource has a__parent__attribute, return that resource's parent, and so on, until the resource being inspected either has no__parent__attribute or which has a__parent__attribute ofNone. For example, if the resource tree is:thing1 = Thing() thing2 = Thing() thing2.__parent__ = thing1
Calling
lineage(thing2)will return a generator. When we turn it into a list, we will get:list(lineage(thing2)) [ <Thing object at thing2>, <Thing object at thing1> ]