vregistry.py
changeset 6428 de95bbed8781
parent 6401 d7f5d873e1b8
child 6666 55a94beb521d
equal deleted inserted replaced
6427:c8a5ac2d1eaa 6428:de95bbed8781
   193         except (NoSelectableObject, ObjectNotFound):
   193         except (NoSelectableObject, ObjectNotFound):
   194             return None
   194             return None
   195     select_object = deprecated('[3.6] use select_or_none instead of select_object'
   195     select_object = deprecated('[3.6] use select_or_none instead of select_object'
   196                                )(select_or_none)
   196                                )(select_or_none)
   197 
   197 
   198     def selectable(self, oid, *args, **kwargs):
       
   199         """return all appobjects having the given oid that are
       
   200         selectable against the given context, in score order
       
   201         """
       
   202         objects = []
       
   203         for appobject in self[oid]:
       
   204             score = appobject.__select__(appobject, *args, **kwargs)
       
   205             if score > 0:
       
   206                 objects.append((score, appobject))
       
   207         return [obj(*args, **kwargs)
       
   208                 for _score, obj in sorted(objects)]
       
   209 
       
   210     def possible_objects(self, *args, **kwargs):
   198     def possible_objects(self, *args, **kwargs):
   211         """return an iterator on possible objects in this registry for the given
   199         """return an iterator on possible objects in this registry for the given
   212         context
   200         context
   213         """
   201         """
   214         for appobjects in self.itervalues():
   202         for appobjects in self.itervalues():