- Timestamp:
- 21 Feb 2007, 17:15:00 (18 years ago)
- Location:
- WAeUP_SRP/trunk/skins
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_utilities/reindex_entry_mode.py
r1408 r1458 12 12 reindex students_catalog entry_mode index 13 13 """ 14 try: 15 from Products.zdb import set_trace 16 except: 17 def set_trace(): 18 pass 19 14 20 request = context.REQUEST 15 21 session = request.SESSION … … 25 31 26 32 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)))33 ##rwrite("entry_mode values: %s<br />\n" % (str(ems))) 34 ##for em in ems: 35 ## res = cat(entry_mode = em) 36 ## rwrite("entry_mode: %s = %d<br />\n" % (em,len(res))) 31 37 32 38 sbrains = cat() 33 39 count = 0 34 40 lines = [] 35 41 #set_trace() 36 42 for sb in sbrains: 37 38 43 em = context.getFromData_entry_mode(sb.id) 39 44 ec = 'x' 40 45 level_cat = sb.level 41 if em in ('UME','DE'): 42 ec = 'cup' 43 #cat.modifyRecord(id = sb.id,entry_mode = em) 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) 46 new_em = context.getEntryMode(sb.jamb_reg_no) 47 if students.hasObject('application'): 48 app = getattr(getattr(students,sb.id),'application') 49 app.getContent().edit(mapping={'entry_mode': new_em}) 50 cat.modifyRecord(id = sb.id,entry_mode = new_em) 47 51 else: 48 ret = context.returning_import(matric_no=sb.matric_no) 49 moe = ret[0].Mode_of_Entry 50 51 if moe in ('DE','DIRECT', 'DIRECT ENTRY',): 52 ec = 'de' 53 new_em = 'DE' 54 elif moe in ('UME','U.M.E', 'UNE',): 55 ec = 'ume' 56 new_em ="UME" 57 else: 58 ec = 'unk' 59 new_em = 'unknown' 60 moe = 'none' 61 62 #app = getattr(getattr(students,sb.id),'application',None) 63 #if app is not None: 64 # app.getContent().edit(mapping={'entry_mode': new_em}) 65 # cat.modifyRecord(id = sb.id,entry_mode = new_em) 66 #else: 67 # cat.modifyRecord(id = sb.id,entry_mode = "") 68 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) 52 cat.modifyRecord(id = sb.id,entry_mode = "") 53 s = '"%s","%s","%s","%s","%s","%s","%s"' % (ec,sb.id,sb.matric_no,em, 54 sb.jamb_reg_no,new_em,level_cat) 55 #lines.append('"%s","%s","%s","%s","%s"' % (ec,sb.id,sb.matric_no,moe,new_em)) 56 rwrite("%s<br />" %s) 72 57 73 58 #setheader('Content-type','text/semicolon-seperated-values')
Note: See TracChangeset for help on using the changeset viewer.