- Timestamp:
- 31 Jan 2007, 16:24:18 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_utilities/reindex_entry_mode.py
r1363 r1380 12 12 reindex students_catalog entry_mode index 13 13 """ 14 request = context.REQUEST 15 session = request.SESSION 16 response = request.RESPONSE 17 students = context.portal_url.getPortalObject().campus.students 18 def rwrite(s): 19 response.setHeader('Content-type','text/html; charset=ISO-8859-15') 20 #response.setHeader('Content-length','%d' % (len(s))) 21 #response.setStatus('OK') 22 response.write(s) 23 14 24 cat = context.students_catalog 15 25 ems = cat.uniqueValuesFor('entry_mode') 26 rwrite("entry_mode values: %s<br />\n" % (str(ems))) 27 for em in ems: 28 res = cat(entry_mode = em) 29 rwrite("entry_mode: %s = %d<br />\n" % (em,len(res))) 30 #from Products.zdb import set_trace;set_trace() 16 31 sbrains = cat() 32 count = 0 33 lc = 1 34 rwrite("%3d " % lc) 17 35 for sb in sbrains: 18 36 normalized = False 19 em= context.getFromData_entry_mode(sb.id) 20 if em: 37 em = context.getFromData_entry_mode(sb.id) 38 ec = 'x' 39 if em is None: 40 ec = 'n' 41 em = 'None' 42 if em in ('UME','DE'): 43 ec = 'C' 21 44 normalized = True 22 45 elif sb.entry_mode in ('DIRECT', 'DIRECT ENTRY',): 46 ec = 'D' 23 47 em = 'DE' 24 48 normalized = True 25 49 elif sb.entry_mode in ('U.M.E', 'UNE',): 50 ec = 'U' 26 51 em ="UME" 27 52 normalized = True 53 elif not sb.entry_mode: 54 ec = 'u' 55 em ="UME" 56 normalized = True 57 if ec != "C" and em != sb.entry_mode: 58 #from Products.zdb import set_trace;set_trace() 59 app = getattr(getattr(students,sb.id),'application',None) 60 ec = 'a' 61 if app is not None: 62 ec = 'A' 63 app.getContent().edit(mapping={'entry_mode': sb.entry_mode}) 28 64 if normalized: 29 65 cat.modifyRecord(id = sb.id, 30 66 entry_mode = em) 67 rwrite(ec) 68 count += 1 69 if count > 60: 70 lc += 1 71 rwrite("<br />\n%3d " % lc) 72 count = 0 31 73
Note: See TracChangeset for help on using the changeset viewer.