Ignore:
Timestamp:
5 Feb 2007, 15:59:08 (18 years ago)
Author:
Henrik Bettermann
Message:

gemaess Telefongespräch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_utilities/reindex_entry_mode.py

    r1389 r1392  
    1616response = request.RESPONSE
    1717students = 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
    2423cat = 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
    3131sbrains = cat()
    3232count = 0
     33lines = []
    3334
    3435for sb in sbrains:
    35     normalized = False
     36
    3637    em = context.getFromData_entry_mode(sb.id)
    3738    ec = 'x'
    3839    if em in ('UME','DE'):
    39         ec = 'cu'
     40        ec = 'cup'
    4041        #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 />")
    4244    else:
    4345        ret = context.returning_import(matric_no=sb.matric_no)
     
    4749            new_em = 'DE'
    4850        elif moe in ('UME','U.M.E', 'UNE',):
    49             ec = 'um'
     51            ec = 'ume'
    5052            new_em ="UME"
    5153        else:
    52             ec = 'un'
     54            ec = 'unk'
    5355            new_em = 'unknown'
    5456            moe = 'none'
     
    5961            #cat.modifyRecord(id = sb.id,entry_mode = new_em)
    6062        #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 = "")
    6464
     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
     68setheader('Content-type','text/semicolon-seperated-values')
     69setheader('Content-Disposition:', 'attachment; filename="fixLevelExport.csv"')
     70setheader('Expires',  'Mon, 26 Jul 1997 05:00:00GMT') # Date in the past
     71setheader('Cache-Control', 'no-store, no-cache,must-revalidate') # HTTP/1.1
     72setheader('Cache-Control', 'post-check=0,pre-check=0')
     73setheader('Pragma', 'no-cache') # HTTP/1.0
     74return '\n'.join(lines)
Note: See TracChangeset for help on using the changeset viewer.