## Script (Python) "reindex_entry_mode" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters= ##title= ## # $Id: setNewEntryMode.py 1703 2007-04-24 17:57:49Z joachim $ """ reindex students_catalog entry_mode index """ try: from Products.zdb import set_trace except: def set_trace(): pass request = context.REQUEST session = request.SESSION response = request.RESPONSE setheader = request.RESPONSE.setHeader students = context.portal_url.getPortalObject().campus.students def rwrite(s): response.setHeader('Content-type','text/html; charset=ISO-8859-15') response.write("%s
\r\n" % s) brains = context.portal_catalog(portal_type = 'StudentApplication') count = 0 #set_trace() for brain in brains: app_doc = brain.getObject().getContent() em = getattr(app_doc,'entry_mode',None) data = {'entry_mode': "%s_ft" % em.lower()} app_doc.edit(mapping=data) count += 1 s = "%d: %s %s -> %s" % (count,brain.getPath(),em,data['entry_mode']) rwrite(s) rwrite('Done')