add parameter usePredicateIndex to getRelations()
This commit is contained in:
parent
bd1aa11beb
commit
1629defe3d
1 changed files with 17 additions and 14 deletions
|
@ -227,7 +227,8 @@ class IndexableRelationAdapter(object):
|
|||
|
||||
# convenience functions:
|
||||
|
||||
def getRelations(first=None, second=None, third=None, relationships=None):
|
||||
def getRelations(first=None, second=None, third=None, relationships=None,
|
||||
usePredicateIndex=False):
|
||||
""" Return a sequence of relations matching the query specified by the
|
||||
parameters.
|
||||
|
||||
|
@ -241,7 +242,9 @@ def getRelations(first=None, second=None, third=None, relationships=None):
|
|||
if third is not None: query['third'] = third
|
||||
if not relationships:
|
||||
return registry.query(**query)
|
||||
else:
|
||||
if len(relationships) == 1 and usePredicateIndex:
|
||||
query['relationship'] = relationships[0]
|
||||
return registry.query(**query)
|
||||
predicates = []
|
||||
for r in relationships:
|
||||
if hasattr(r, 'predicate'):
|
||||
|
|
Loading…
Add table
Reference in a new issue