- Timestamp:
- 5 Feb 2007, 15:59:08 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_utilities/reindex_entry_mode.py
r1389 r1392 16 16 response = request.RESPONSE 17 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 18 19 #def rwrite(s): 20 # response.setHeader('Content-type','text/html; charset=ISO-8859-15') 21 # response.write(s) 22 24 23 cat = context.students_catalog 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() 24 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 31 31 sbrains = cat() 32 32 count = 0 33 lines = [] 33 34 34 35 for sb in sbrains: 35 normalized = False 36 36 37 em = context.getFromData_entry_mode(sb.id) 37 38 ec = 'x' 38 39 if em in ('UME','DE'): 39 ec = 'cu '40 ec = 'cup' 40 41 #cat.modifyRecord(id = sb.id,entry_mode = em) 41 rwrite(ec +"--"+ sb.id +"--"+ em +"<br />") 42 lines.append('"%s","%s","","%s",""' % (ec,sb.id,sb.em)) 43 #rwrite(ec +"--"+ sb.id +"--"+ em +"<br />") 42 44 else: 43 45 ret = context.returning_import(matric_no=sb.matric_no) … … 47 49 new_em = 'DE' 48 50 elif moe in ('UME','U.M.E', 'UNE',): 49 ec = 'um '51 ec = 'ume' 50 52 new_em ="UME" 51 53 else: 52 ec = 'un '54 ec = 'unk' 53 55 new_em = 'unknown' 54 56 moe = 'none' … … 59 61 #cat.modifyRecord(id = sb.id,entry_mode = new_em) 60 62 #else: 61 #cat.modifyRecord(id = sb.id,entry_mode = None) 62 63 rwrite(ec +"--"+ sb.id +"--"+ em +"--"+ moe +"--"+ new_em +"<br />") 63 #cat.modifyRecord(id = sb.id,entry_mode = "") 64 64 65 lines.append('"%s","%s","%s","%s","%s"' % (ec,sb.id,sb.matric_no,moe,new_em)) 66 #rwrite(ec +"--"+ sb.id +"--"+ em +"--"+ moe +"--"+ new_em +"<br />") 67 68 setheader('Content-type','text/semicolon-seperated-values') 69 setheader('Content-Disposition:', 'attachment; filename="fixLevelExport.csv"') 70 setheader('Expires', 'Mon, 26 Jul 1997 05:00:00GMT') # Date in the past 71 setheader('Cache-Control', 'no-store, no-cache,must-revalidate') # HTTP/1.1 72 setheader('Cache-Control', 'post-check=0,pre-check=0') 73 setheader('Pragma', 'no-cache') # HTTP/1.0 74 return '\n'.join(lines)
Note: See TracChangeset for help on using the changeset viewer.