repoze.bfg.location

Location support loosely based from zope.location, but without zope.security support or proxy support, neither of which is used by repoze.bfg

repoze.bfg.location.lineage(model)

Return a generator representing the model lineage. The generator first returns model unconditionally. Then, if model supplies a __parent__ attribute, return the object represented by model.__parent__. If that object has a __parent__ attribute, return that object’s parent, and so on, until the object being inspected either has no __parent__ attribute or which has a __parent__ attribute of None. For example, if the object 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> ]
repoze.bfg.location.inside(model1, model2)

Is model1 ‘inside’ model2? Return True if so, else False.

model1 is ‘inside’ model2 if model2 is a location ancestor of model1. It is a location ancestor if its parent (or one of its parent’s parents, etc.) is an ancestor.

Previous topic

repoze.bfg.events

Next topic

repoze.bfg.paster

This Page

Quick search