def addKeyToCatalog(portal): ''' @summary: takes portal_catalog and adds a key to it @param context: context providing portal_catalog ''' pc = portal.portal_catalog indexes = pc.indexes() for idx in getKeysToAdd(): if idx[0] in indexes: logger.info("Found the '%s' index in the catalog, nothing changed.\n" % idx[0]) else: pc.addIndex(name=idx[0], type=idx[1], extra=idx[2]) logger.info("Added '%s' (%s) to the catalog.\n" % (idx[0], idx[1]))
def addKeyToCatalog(portal): ''' @summary: takes portal_catalog and adds a key to it @param context: context providing portal_catalog ''' pc = portal.portal_catalog indexes = pc.indexes() for idx in getKeysToAdd(): if idx[0] in indexes: logger.info( "Found the '%s' index in the catalog, nothing changed.\n" % idx[0]) else: pc.addIndex(name=idx[0], type=idx[1], extra=idx[2]) logger.info("Added '%s' (%s) to the catalog.\n" % (idx[0], idx[1]))
def __call__(self): """ """ utility_name = 'collective.dancing.jobs' sm = getSiteManager() message = "" queue = component.queryUtility(IQueue, utility_name) if queue: if sm.unregisterUtility(provided=IQueue, name=utility_name): message = 'Utility removed from portal_newsletters' logger.info(message) else: message = 'Utility not removed from portal_newsletters. Are you in the right place?' logger.error(message) else: message = 'Utility not removed from portal_newsletters. Are you in the right place?' logger.error(message) pu = getToolByName(self.context, "plone_utils") pu.addPortalMessage(message) return self.request.response.redirect(self.context.portal_url())
def to_1000(context): """ Replace old named utilites based on path with new based on uid """ logger.info('Upgrading collective.dancefloor to version 1.0.0') pc = getToolByName(context, 'portal_catalog', None) newsletters = pc(dancefloor_enabled=True, object_provides=IDanceFloor.__identifier__) for newsletter in newsletters: nl_obj = newsletter.getObject() disable_old_parties(nl_obj) enable_party(nl_obj) logger.info('Updated named utility for: %s' % newsletter.getPath()) logger.info('Upgrades old named utilities.')