- Timestamp:
- 11 Feb 2007, 22:35:16 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_utilities/reindex_entry_mode.py
r1407 r1408 15 15 session = request.SESSION 16 16 response = request.RESPONSE 17 setheader = request.RESPONSE.setHeader 17 18 students = context.portal_url.getPortalObject().campus.students 18 19 19 #def rwrite(s):20 #response.setHeader('Content-type','text/html; charset=ISO-8859-15')21 #response.write(s)20 def rwrite(s): 21 response.setHeader('Content-type','text/html; charset=ISO-8859-15') 22 response.write(s) 22 23 23 24 cat = context.students_catalog 24 25 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)))26 ems = cat.uniqueValuesFor('entry_mode') 27 rwrite("entry_mode values: %s<br />\n" % (str(ems))) 28 for em in ems: 29 res = cat(entry_mode = em) 30 rwrite("entry_mode: %s = %d<br />\n" % (em,len(res))) 30 31 31 32 sbrains = cat() … … 37 38 em = context.getFromData_entry_mode(sb.id) 38 39 ec = 'x' 40 level_cat = sb.level 39 41 if em in ('UME','DE'): 40 42 ec = 'cup' 41 43 #cat.modifyRecord(id = sb.id,entry_mode = em) 42 lines.append('"%s","%s","","%s",""' % (ec,sb.id,em)) 43 #rwrite(ec +"--"+ sb.id +"--"+ em +"<br />") 44 s = '"%s","%s","","%s","","%s"' % (ec,sb.id,em,level_cat) 45 #lines.append('"%s","%s","","%s",""' % (ec,sb.id,em)) 46 rwrite("%s<br />" %s) 44 47 else: 45 48 ret = context.returning_import(matric_no=sb.matric_no) 46 49 moe = ret[0].Mode_of_Entry 50 47 51 if moe in ('DE','DIRECT', 'DIRECT ENTRY',): 48 52 ec = 'de' … … 58 62 #app = getattr(getattr(students,sb.id),'application',None) 59 63 #if app is not None: 60 #app.getContent().edit(mapping={'entry_mode': new_em})61 #cat.modifyRecord(id = sb.id,entry_mode = new_em)64 # app.getContent().edit(mapping={'entry_mode': new_em}) 65 # cat.modifyRecord(id = sb.id,entry_mode = new_em) 62 66 #else: 63 #cat.modifyRecord(id = sb.id,entry_mode = "")67 # cat.modifyRecord(id = sb.id,entry_mode = "") 64 68 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 />") 69 s = '"%s","%s","%s","%s","%s","%s"' % (ec,sb.id,sb.matric_no,moe,new_em,level_cat) 70 #lines.append('"%s","%s","%s","%s","%s"' % (ec,sb.id,sb.matric_no,moe,new_em)) 71 rwrite("%s<br />" %s) 67 72 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) 73 #setheader('Content-type','text/semicolon-seperated-values') 74 #setheader('Content-Disposition:', 'attachment; filename="fixLevelExport.csv"') 75 #setheader('Expires', 'Mon, 26 Jul 1997 05:00:00GMT') # Date in the past 76 #setheader('Cache-Control', 'no-store, no-cache,must-revalidate') # HTTP/1.1 77 #setheader('Cache-Control', 'post-check=0,pre-check=0') 78 #setheader('Pragma', 'no-cache') # HTTP/1.0 79 #return '\n'.join(lines) 80 81 rwrite("<br />\n Done" ) 82
Note: See TracChangeset for help on using the changeset viewer.