@@ -453,19 +453,24 @@ def lookup(self, obj, add=False):
453453 # identity view on it.
454454 try :
455455 for candidate_node in self .internal [lower_nodes [- 1 ]]:
456- return candidate_node .view (obj )
457- # FIXME: It might be useful to optionally not silence OrientationError,
458- # since that more often than not indicates a real error
459- except (KeyError , OrientationError ):
460- if not add :
461- raise KeyError ("No such object found" )
462- node = TopologicalNode (self , obj , lower_nodes )
463- # Assign the new node to each possible permutation of lower-order
464- # nodes. This is slight overkill since some of these permutations
465- # are invalid, but c'est la vie.
466- for p in permutations (lower_nodes [- 1 ]):
467- self .internal .setdefault (p , []).append (node )
468- return node .view ()
456+ try :
457+ return candidate_node .view (obj )
458+ # FIXME: It might be useful to optionally not silence OrientationError,
459+ # since that more often than not indicates a real error
460+ except OrientationError :
461+ pass
462+ except KeyError :
463+ pass
464+
465+ if not add :
466+ raise KeyError ("No such object found" )
467+ node = TopologicalNode (self , obj , lower_nodes )
468+ # Assign the new node to each possible permutation of lower-order
469+ # nodes. This is slight overkill since some of these permutations
470+ # are invalid, but c'est la vie.
471+ for p in permutations (lower_nodes [- 1 ]):
472+ self .internal .setdefault (p , []).append (node )
473+ return node .view ()
469474
470475 def add (self , obj ):
471476 """Add new nodes to the graph to accommodate the given object, then return the
0 commit comments