Пример #1
0
 def query(self,
           my_role=None,
           target=None,
           role=None,
           rel_type=None,
           catalog=None):
     if catalog is None:
         catalog = self.catalog
     empty = IFBTree.TreeSet()
     this_hash = hash_persistent(self.__parent__)
     result = None
     if my_role is not None:
         ids = catalog['my_role_hash'].values_to_documents.get(
             (hash(my_role), this_hash), empty)
         if result is None:
             result = ids
         else:
             result = IFBTree.intersection(result, ids)
         if not result:
             return result
     if target is not None:
         ids = catalog['target'].values_to_documents.get(
             (IKeyReference(target), this_hash), empty)
         if result is None:
             result = ids
         else:
             result = IFBTree.intersection(result, ids)
         if not result:
             return result
     if role is not None:
         ids = catalog['role_hash'].values_to_documents.get(
             (hash(role), this_hash), empty)
         if result is None:
             result = ids
         else:
             result = IFBTree.intersection(result, ids)
         if not result:
             return result
     if rel_type is not None:
         ids = catalog['rel_type_hash'].values_to_documents.get(
             (hash(rel_type), this_hash), empty)
         if result is None:
             result = ids
         else:
             result = IFBTree.intersection(result, ids)
     return result
Пример #2
0
 def query(self, my_role=None, target=None, role=None, rel_type=None, catalog=None):
     if catalog is None:
         catalog = self.catalog
     empty = IFBTree.TreeSet()
     this_hash = hash_persistent(self.__parent__)
     result = None
     if my_role is not None:
         ids = catalog['my_role_hash'].values_to_documents.get(
             (hash(my_role), this_hash), empty)
         if result is None:
             result = ids
         else:
             result = IFBTree.intersection(result, ids)
         if not result:
             return result
     if target is not None:
         ids = catalog['target'].values_to_documents.get(
             (IKeyReference(target), this_hash), empty)
         if result is None:
             result = ids
         else:
             result = IFBTree.intersection(result, ids)
         if not result:
             return result
     if role is not None:
         ids = catalog['role_hash'].values_to_documents.get(
             (hash(role), this_hash), empty)
         if result is None:
             result = ids
         else:
             result = IFBTree.intersection(result, ids)
         if not result:
             return result
     if rel_type is not None:
         ids = catalog['rel_type_hash'].values_to_documents.get(
             (hash(rel_type), this_hash), empty)
         if result is None:
             result = ids
         else:
             result = IFBTree.intersection(result, ids)
     return result
Пример #3
0
def evolveLinkSets(connection, oids):
    int_ids = getSite()._sm.getUtility(IIntIds)

    for oid in oids:
        try:
            linkset = connection.get(oid)
        except KeyError:
            continue
        if getattr(linkset, '_lids', None) is None:
            linkset._lids = IFBTree.TreeSet()
        linkset._lids.clear()
        for link in linkset._links.values():
            linkset._lids.add(int_ids.getId(link))
Пример #4
0
 def __init__(self, title):
     self._ids = IFBTree.IFTreeSet()
     self.title = title
Пример #5
0
 def __init__(self):
     self._lids = IFBTree.TreeSet()
     self._links = OOBTree()