source: WAeUP_SRP/trunk/skins/waeup_student/refresh_certificate_info.py @ 1138

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

context.setupCurrentSkin() after login enabled for all

  • Property svn:keywords set to Id
File size: 975 bytes
RevLine 
[1093]1##parameters=REQUEST, certid=None
2# $Id: refresh_certificate_info.py 1094 2006-12-19 12:11:44Z henrik $
3"""
4refresh the certificate info in the students_catalog
5"""
6request = context.REQUEST
7if not certid:
8    return "Certificate not specified"
9
10course = request.get('certid')
11res = context.portal_catalog(portal_type='Certificate',id = course)
12if not res:
13    return "Certificate %s not found"
14c_brain = res[0]
15c_path = c_brain.getPath().split('/')
16faculty = c_path[-4]
17department = c_path[-3]
18s_cat = context.students_catalog
19s_res = s_cat(course = certid)
[1094]20#from Products.zdb import set_trace
21#set_trace()
[1093]22if not s_res:
23    return "No students for %s not found"
24refreshed = []
25refreshed.append("Record started")
[1094]26for student_id in [st.id  for st in s_res]:
[1093]27    s_cat.modifyRecord(id = student_id,
28                       course = course,
29                       faculty = faculty,
30                       department = department,
31                       )
32    refreshed.append("Record %s refreshed" % student_id)
33return '\r'.join(refreshed)
Note: See TracBrowser for help on using the repository browser.