def reindexIndexes(context): """Reindex some indexes. Indexes that are added in the catalog.xml file get cleared everytime the GenericSetup profile is applied. So we need to reindex them. Since we are forced to do that, we might as well make sure that these get reindexed in the correct order. """ if isNotECAssignmentBoxProfile(context): return site = context.getSite() pc = getToolByName(site, "portal_catalog") indexes = [ "isAssignmentBoxType", "isAssignmentType", "getRawAssignment_reference", "getRawRelatedItems", "review_state", ] # Don't reindex an index if it isn't actually in the catalog. # Should not happen, but cannot do any harm. ids = [id for id in indexes if id in pc.indexes()] if ids: pc.manage_reindexIndex(ids=ids) LOG.info("Indexes %s re-indexed." % indexes)
def reindexIndexes(context): """Reindex some indexes. Indexes that are added in the catalog.xml file get cleared everytime the GenericSetup profile is applied. So we need to reindex them. Since we are forced to do that, we might as well make sure that these get reindexed in the correct order. """ if isNotECAssignmentBoxProfile(context): return site = context.getSite() pc = getToolByName(site, 'portal_catalog') indexes = [ 'isAssignmentBoxType', 'isAssignmentType', 'getRawAssignment_reference', 'getRawRelatedItems', 'review_state', ] # Don't reindex an index if it isn't actually in the catalog. # Should not happen, but cannot do any harm. ids = [id for id in indexes if id in pc.indexes()] if ids: pc.manage_reindexIndex(ids=ids) LOG.info('Indexes %s re-indexed.' % indexes)
def installQIDependencies(context): """Install dependencies""" if isNotECAssignmentBoxProfile(context): return site = context.getSite() portal = getToolByName(site, 'portal_url').getPortalObject() quickinstaller = portal.portal_quickinstaller for dependency in config.DEPENDENCIES: if quickinstaller.isProductInstalled(dependency): LOG.info('Reinstalling dependency %s:' % dependency) quickinstaller.reinstallProducts([dependency]) transaction.savepoint() else: LOG.info('Installing dependency %s:' % dependency) quickinstaller.installProduct(dependency) transaction.savepoint()
def installQIDependencies(context): """Install dependencies""" if isNotECAssignmentBoxProfile(context): return site = context.getSite() portal = getToolByName(site, "portal_url").getPortalObject() quickinstaller = portal.portal_quickinstaller for dependency in config.DEPENDENCIES: if quickinstaller.isProductInstalled(dependency): LOG.info("Reinstalling dependency %s:" % dependency) quickinstaller.reinstallProducts([dependency]) transaction.savepoint() else: LOG.info("Installing dependency %s:" % dependency) quickinstaller.installProduct(dependency) transaction.savepoint()
LOG.error('Cannot send notification email: %s' % e) return msg['Subject'] = subjHeader msg['From'] = fromAddress msg['Subject'] = subject # This is a hack to suppress deprecation messages about send() # in SecureMailHost; the proposed alternative, secureSend(), # sucks. mailHost._v_send = 1 for address in addresses: if address: try: LOG.info("Sending email to %r" % address) msg['To'] = address mailHost.send(msg.as_string()) except ConflictError, ce: LOG.error('Failed sending email: %s' % ce) raise except Exception, e: LOG.error('Failed sending email from %s to %s' % (fromAddress, address)) LOG.error("Reason: %s: %r" % (e.__class__.__name__, str(e))) # end if # end for
LOG.error('Cannot send notification email: %s' % e) return msg['Subject'] = subjHeader msg['From'] = fromAddress msg['Subject'] = subject # This is a hack to suppress deprecation messages about send() # in SecureMailHost; the proposed alternative, secureSend(), # sucks. mailHost._v_send = 1 for address in addresses: if address: try: LOG.info("Sending email to %r" % address) msg['To'] = address mailHost.send(msg.as_string()) except ConflictError, ce: LOG.error('Failed sending email: %s' % ce) raise except Exception, e: LOG.error('Failed sending email from %s to %s' % (fromAddress, address)) LOG.error("Reason: %s: %r" % (e.__class__.__name__, str(e))) # end if # end for