def setupIndexes(self): changed = False for idx in self.indexAttributes: if idx not in self.indexes: self.indexes[idx] = FieldIndex() changed = True if changed: self.reindexTracks()
def __init__(self, *args, **kw): super(TrackingStorage, self).__init__(*args, **kw) self.indexes = OOBTree.OOBTree() for idx in self.indexAttributes: self.indexes[idx] = FieldIndex() self.runs = IOBTree.IOBTree() self.currentRuns = OOBTree.OOBTree() self.taskUsers = OOBTree.OOBTree()
def __init__(self, context): self.context = context annotations = IAnnotations(context) if not "chatbehavior.messages" in annotations: annotations["chatbehavior.messages"] = IOBTree() if not "chatbehavior.index" in annotations: annotations["chatbehavior.index"] = FieldIndex() self.index = annotations["chatbehavior.index"] self.messages = annotations["chatbehavior.messages"]
print "Usage: <instancehome>/bin/instance run %s <id>" % sys.argv[0] sys.exit(1) portal = app[portal_id] setSite(portal) # we assume there is an admin user user = app.acl_users.getUser('admin') newSecurityManager(None, user.__of__(app.acl_users)) pmt = getToolByName(portal, 'portal_membership') uc = getUtility(IUserCatalog, context=portal) # we added _regdate later so we can't assume the catalog has this index # yet if not hasattr(uc, '_regdate'): uc._regdate = FieldIndex() if not hasattr(uc, '_metadata'): uc._metadata = IOBTree() ints = getUtility(IIntIds) for index, mid in enumerate(pmt.listMemberIds()): member = pmt.getMemberById(mid) mintid = ints.queryId(member) regdate = member.getProperty('registrationdate') regdate = datetime.datetime.strptime(regdate.strftime("%Y-%m-%d"), "%Y-%m-%d") if not uc._metadata.has_key(mintid): uc.index(member) print "Indexing", mid