Exemple #1
0
    def convert(self):
        if self.request.method == 'POST':
            authenticator = getMultiAdapter((self.context, self.request),
                                            name=u"authenticator")
            if not authenticator.verify():
                raise Unauthorized

            es = ElasticSearch(self.context)
            es.convertToElastic()
        site = aq_parent(self.context)
        self.request.response.redirect('%s/@@elastic-controlpanel' %
                                       (site.absolute_url()))
    def setUp(self):
        self.portal = self.layer['portal']
        self.request = self.layer['request']
        self.app = self.layer['app']

        registry = getUtility(IRegistry)
        settings = registry.forInterface(IElasticSettings)
        settings.mode = DUAL_MODE

        self.catalog = getToolByName(self.portal, 'portal_catalog')
        self.es = ElasticSearch(self.catalog)
        self.es.convertToElastic()
        self.catalog.manage_catalogRebuild()
        # need to commit here so all tests start with a baseline
        # of elastic enabled
        transaction.commit()
        patched = PatchCaller(self.catalog)
        self.searchResults = patched.searchResults
def refreshCatalog(self, clear=0, pghandler=None):
    """ need to be publishable """
    es = ElasticSearch(self)
    return es.refreshCatalog(clear, pghandler)
def manage_catalogClear(self, REQUEST=None, RESPONSE=None, URL1=None):
    """ need to be publishable """
    es = ElasticSearch(self)
    return es.manage_catalogClear(REQUEST, RESPONSE, URL1)
def manage_catalogRebuild(self, REQUEST=None, RESPONSE=None):
    """ need to be publishable """
    es = ElasticSearch(self)
    return es.manage_catalogRebuild(REQUEST, RESPONSE)
def safeSearchResults(self, REQUEST=None, **kw):
    es = ElasticSearch(self)
    return es.searchResults(REQUEST, check_perms=True, **kw)
def uncatalog_object(self, uid, obj=None, *args, **kwargs):
    es = ElasticSearch(self)
    return es.uncatalog_object(uid, obj, *args, **kwargs)
def catalog_object(self, object, uid=None, idxs=[],
                   update_metadata=1, pghandler=None):
    es = ElasticSearch(self)
    return es.catalog_object(object, uid, idxs, update_metadata, pghandler)
 def __init__(self, *args, **kwargs):
     super(ElasticControlPanelFormWrapper, self).__init__(*args, **kwargs)
     self.portal_catalog = getToolByName(self.context, 'portal_catalog')
     self.es = ElasticSearch(self.portal_catalog)