source: WAeUP_SRP/trunk/skins/waeup_utilities/fixLevelFromResults.py @ 1389

Last change on this file since 1389 was 1388, checked in by Henrik Bettermann, 18 years ago

siehe Email

  • Property svn:keywords set to Id
File size: 2.6 KB
RevLine 
[1387]1## Script (Python) "search_pins"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=REQUEST
8##title=
9##
10# $Id: fixLevelFromResults.py 1388 2007-02-04 08:48:18Z henrik $
11"""
12list Students for ClearanceOfficers
13"""
14
15request = REQUEST
16request = context.REQUEST
17session = request.SESSION
18response = request.RESPONSE
19def rwrite(s):
20    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
21    #response.setHeader('Content-length','%d' % (len(s)))
22    #response.setStatus('OK')
23    response.write(s)
24wftool = context.portal_workflow
25mtool = context.portal_membership
26member = mtool.getAuthenticatedMember()
27roles = member.getRolesInContext(context)
28retcat = context.returning_import
29rcat = context.results_import
30scat = context.students_catalog
31from Products.AdvancedQuery import Eq, Between, Le,In
32aq_students = context.students_catalog.evalAdvancedQuery
33students = context.portal_url.getPortalObject().campus.students
34
35if str(member) not in ('admin','joachim'):
36    return
37count = 0
38lc = 1
39#from Products.zdb import set_trace;set_trace()
40res = scat()
41for sbrain in res:
[1388]42    ec = "nor"
[1387]43    erg = context.results_import(matric_no=sbrain.matric_no)
44    if erg and erg[0].Level:
45        ec = "e"
46        level = erg[0].Level
47        for e in erg:
48            ec = "E"
49            if level != e.Level:
50                ec = "%s:%s!=%s<br />\n" % (sbrain.matric_no,level,e.Level)
51        level = "%d" % (int(level) + 100)
[1388]52       
53        # würde ich an dieser Stelle nicht machen (siehe unten)
54        #context.students_catalog.modifyRecord(id = sbrain.id, level=level)
55       
[1387]56        while True:
57            student = getattr(students,sbrain.id,None)
[1388]58            ec = "nos"
[1387]59            if student is None:
60                break
[1388]61            ec = "nyr"
[1387]62            study_course = getattr(student,"study_course", None)
63            if study_course is None:
64                break
65            study_course.getContent().edit(mapping = {'current_level':level})
[1388]66           
67            #dies ist der richtige Platz
68            context.students_catalog.modifyRecord(id = sbrain.id, level=level) 
69           
70            ec = "reg"
[1387]71            break
[1388]72        if sbrain.level:
73            old_level = str(sbrain.level)
74        else:
75            old_level = 'non'
76        rwrite(ec +"--"+ sbrain.id +"--"+ sbrain.matric_no +"--"+ old_level +"--"+ level +"<br />")
77       
78    else:
79        rwrite(ec +"--"+ sbrain.id +"--"+ sbrain.matric_no + "<br />")
80#    count += 1
81#    if count > 60:
82#        lc += 1
83#        rwrite("<br />\n%3d " % lc)
84#        count = 0
[1387]85rwrite("<br />\n Done" )
[1388]86
Note: See TracBrowser for help on using the repository browser.