Index: WAeUP_SRP/trunk/skins/waeup_student/course_result_list.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/course_result_list.py	(revision 3781)
+++ WAeUP_SRP/trunk/skins/waeup_student/course_result_list.py	(revision 3781)
@@ -0,0 +1,72 @@
+## Script (Python) "course_result_list"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=course_id=None
+##title=
+##
+# $Id: course_result_list.py 3136 2008-02-09 18:11:00Z henrik $
+"""
+export course_result_list
+"""
+request = context.REQUEST
+setheader = request.RESPONSE.setHeader
+cr = context.course_results
+scat = context.students_catalog
+st_schema = context.students_catalog.schema()
+fields = ("id",
+          "name",
+          "matric_no",
+          "jamb_reg_no",
+          "sex",
+          "email",
+          "phone",
+          "faculty",
+          "department",
+          "course",
+          "session",          
+          "level",
+          "review_state",
+          "course_id",
+          "session_id",
+          "level_id",
+          "credits",
+          "score",
+          "carry_over",
+          )
+res_list = []
+lines = []
+lines.append(','.join(fields))
+format = '"%(' + ')s","%('.join(fields) + ')s"'
+
+res = context.course_results(code=course_id)
+items = [ brain for brain in res]
+
+
+
+for r in items:
+    student_record = context.students_catalog.getRecordByKey(r.student_id)
+    line = context.getFormattedStudentEntry(student_record)
+    if r['carry_over']:
+        line['carry_over'] =  'CO'
+    else:
+        line['carry_over'] =  ''
+    line['credits'] =  r['credits']
+    line['session_id'] =  r['session_id']
+    line['level_id'] =  level_id = r['level_id']
+    line['score'] =  r['score']
+    line['course_id'] =  r['code']
+    lines.append(format % line)
+
+    
+#setheader('Content-type', 'text/x-cvs')
+#setheader('Content-type','application/vnd.ms-excel')
+setheader('Content-type','text/semicolon-seperated-values')
+setheader('Content-Disposition:', 'attachment; filename="%s.csv"' % course_id)
+setheader('Expires',  'Mon, 26 Jul 1997 05:00:00GMT') # Date in the past
+setheader('Cache-Control', 'no-store, no-cache,must-revalidate') # HTTP/1.1
+setheader('Cache-Control', 'post-check=0,pre-check=0')
+#setheader('Pragma', 'no-cache') # HTTP/1.0
+return '\n'.join(lines)
Index: WAeUP_SRP/trunk/skins/waeup_utilities/ti_507_2_resolve.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_utilities/ti_507_2_resolve.py	(revision 3781)
+++ WAeUP_SRP/trunk/skins/waeup_utilities/ti_507_2_resolve.py	(revision 3781)
@@ -0,0 +1,51 @@
+## Script (Python) "ti_507_2_resolve"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=
+##title=
+##
+# $Id: ti_507_2_resolve.py 3780 2008-11-21 09:26:51Z henrik $
+"""
+"""
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
+
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+if str(member) not in ('admin'):
+    return
+
+import logging
+logger = logging.getLogger('Skins.ti_507_2_resolve')
+sc = context.students_catalog
+students = sc()
+logger.info('start')
+for student in students:
+    if student.course:
+        course = student.course
+        certificate = context.certificates_catalog(code=course)
+        if not certificate:
+            logger.info("%s, certificate %s does not exist" % (student.id,course))
+            continue
+        if certificate[0].study_mode:
+            correct_mode = certificate[0].study_mode
+        else: 
+            logger.info("%s, certificate %s has no study_mode" % (student.id,course))
+            continue
+        if not student.mode:
+            logger.info("%s had no study_mode" % (student.id))
+        if student.mode != correct_mode:
+            old_mode = student.mode
+            d = {}
+            d['id'] = student.id
+            d['mode'] = correct_mode
+            sc.modifyRecord(**d)
+            logger.info("%s, mode %s replaced by %s" % (student.id,old_mode,correct_mode))
+logger.info('finished')
+            
