Changeset 1458 for WAeUP_SRP


Ignore:
Timestamp:
21 Feb 2007, 17:15:00 (18 years ago)
Author:
joachim
Message:

new getEntryMode
used by reindex_entry_mode modification enabled

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  
    1212reindex students_catalog entry_mode index
    1313"""
     14try:
     15    from Products.zdb import set_trace
     16except:
     17    def set_trace():
     18        pass
     19
    1420request = context.REQUEST
    1521session = request.SESSION
     
    2531
    2632ems = 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)))
    3137
    3238sbrains = cat()
    3339count = 0
    3440lines = []
    35 
     41#set_trace()
    3642for sb in sbrains:
    37 
    3843    em = context.getFromData_entry_mode(sb.id)
    3944    ec = 'x'
    4045    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)
    4751    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)
    7257
    7358#setheader('Content-type','text/semicolon-seperated-values')
Note: See TracChangeset for help on using the changeset viewer.