source: WAeUP_SRP/trunk/skins/waeup_student/fixLevel.py @ 1250

Last change on this file since 1250 was 1250, checked in by joachim, 18 years ago

set the level from results, also getCredential return the student_pw, fixLevel fixes existing levels

  • Property svn:keywords set to Id
File size: 1.3 KB
Line 
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: fixLevel.py 1250 2007-01-09 17:19:20Z joachim $
11"""
12list Students for ClearanceOfficers
13"""
14
15request = REQUEST
16wftool = context.portal_workflow
17mtool = context.portal_membership
18member = mtool.getAuthenticatedMember()
19roles = member.getRolesInContext(context)
20retcat = context.returning_import
21rcat = context.results_import
22scat = context.students_catalog
23from Products.AdvancedQuery import Eq, Between, Le,In
24aq_students = context.students_catalog.evalAdvancedQuery
25
26if str(member) not in ('admin','joachim'):
27    return
28count = 0
29#from Products.zdb import set_trace;set_trace()
30values = scat.uniqueValuesFor('level')
31#query = ~ In("level",('100', '200', '300', '400', '500', '600'))
32query = In("level",('',))
33res = aq_students(query)
34#from Products.zdb import set_trace;set_trace()
35modified = []
36modified.append("%d to change" % len(res))
37list = []
38for sbrain in res:
39    list.append((sbrain.id,sbrain.matric_no))
40for id,m in list:
41    erg = context.results_import(matric_no=m)
42    if erg and erg[0].Level:
43        context.students_catalog.modifyRecord(id = id, level=erg[0].Level)
44        modified.append("%s, %s" % (id,m))
45    else:
46        modified.append("no results for %s, %s" % (id,m))
47return '\n'.join(modified)
Note: See TracBrowser for help on using the repository browser.