Last change
on this file since 6698 was
5607,
checked in by Henrik Bettermann, 14 years ago
|
refresh_certificate_info.py: Simplify reindexing.
getInterswitchParams.py: Include 100 level fresh students.
|
File size:
988 bytes
|
Line | |
---|
1 | ##parameters=REQUEST, certid=None |
---|
2 | # $Id: refresh_certificate_info.py 1094 2006-12-19 12:11:44Z henrik $ |
---|
3 | """ |
---|
4 | refresh the certificate info in the students_catalog |
---|
5 | """ |
---|
6 | request = context.REQUEST |
---|
7 | if not certid: |
---|
8 | return "Certificate not specified" |
---|
9 | |
---|
10 | course = request.get('certid') |
---|
11 | res = context.certificates_catalog(code = course) |
---|
12 | if not res: |
---|
13 | return "Certificate %s not found" |
---|
14 | faculty = res[0].faculty |
---|
15 | department = res[0].department |
---|
16 | s_cat = context.students_catalog |
---|
17 | s_res = s_cat(course = certid) |
---|
18 | #from Products.zdb import set_trace |
---|
19 | #set_trace() |
---|
20 | if not s_res: |
---|
21 | return "No students for %s not found" |
---|
22 | refreshed = [] |
---|
23 | refreshed.append("Record started") |
---|
24 | for student_id in [st.id for st in s_res]: |
---|
25 | s_cat.modifyRecord(id = student_id, |
---|
26 | faculty = faculty, |
---|
27 | department = department, |
---|
28 | ) |
---|
29 | refreshed.append("Record %s refreshed, faculty = %s, department = %s" % (student_id,faculty,department)) |
---|
30 | return '\r'.join(refreshed) |
---|
Note: See
TracBrowser for help on using the repository browser.