Index: /WAeUP_SRP/trunk/WAeUPTables.py
===================================================================
--- /WAeUP_SRP/trunk/WAeUPTables.py	(revision 3780)
+++ /WAeUP_SRP/trunk/WAeUPTables.py	(revision 3781)
@@ -1028,4 +1028,6 @@
 
     def reindexIndex(self, name, REQUEST,pghandler=None): ###(
+        if not hasattr(self,'_v_certificates'):
+            self._v_certificates = self.fill_certificates_dict()
         if isinstance(name, str):
             name = (name,)
@@ -1033,5 +1035,5 @@
         reindex_special = []
         for n in name:
-            if n in ("review_state","registered_courses"):
+            if n in ("review_state"):
                 reindex_special.append(n)
             else:
@@ -1043,7 +1045,7 @@
                             reindextypes[pt]= [n]
                         break
-        cached_data = {}
-        if set(name).intersection(set(('faculty','department','end_level'))):
-            cached_data = self.fill_certificates_dict()
+        #cached_data = {}
+        #if set(name).intersection(set(('faculty','department','end_level','mode'))):
+        #    cached_data = self.fill_certificates_dict()
         students = self.portal_catalog(portal_type="Student")
         if hasattr(self,'portal_catalog_real'):
@@ -1060,10 +1062,4 @@
             student_brain = students[i]
             student_object = student_brain.getObject()
-            # query = Eq('path',student_brain.getPath())
-            # sub_brains_list = aq_portal(query)
-            # sub_brains = {}
-            # for sub_brain in sub_brains_list:
-            #     sub_brains[sub_brain.portal_type] = sub_brain
-            # student_path = student_brain.getPath()
             data = {}
             modified = False
@@ -1077,7 +1073,4 @@
                 try:
                     doc = getattr(student_object,self.affected_types[pt]['id']).getContent()
-                    #doc = sub_brains[pt].getObject().getContent()
-                    # path = "%s/%s" % (student_path,self.affected_types[pt]['id'])
-                    # doc = self.unrestrictedTraverse(path).getContent()
                     sub_objects = True
                 except:
@@ -1085,6 +1078,5 @@
                 for field in set(name).intersection(self.affected_types[pt]['fields']):
                     if hasattr(self,'get_from_doc_%s' % field):
-                        data[field] = getattr(self,'get_from_doc_%s' % field)(doc,
-                                                                              cached_data=cached_data)
+                        data[field] = getattr(self,'get_from_doc_%s' % field)(doc)
                     else:
                         data[field] = getattr(doc,field)
@@ -1100,22 +1092,4 @@
                                              import_record.Lastname)
                 data['jamb_reg_no'] = import_record.Entryregno
-            #if reindex_special and 'registered_courses' in reindex_special:
-            #    try:
-            #        study_course = getattr(student_object,"study_course")
-            #        level_ids = study_course.objectIds()
-            #    except:
-            #        continue
-            #    if not level_ids:
-            #        continue
-            #    modified = True
-            #    level_ids.sort()
-            #    course_ids = getattr(study_course,level_ids[-1]).objectIds()
-            #    courses = []
-            #    for c in course_ids:
-            #        if c.endswith('_co'):
-            #            courses.append(c[:-3])
-            #        else:
-            #            courses.append(c)
-            #    data['registered_courses'] = courses
             if modified:
                 self.modifyRecord(**data)
@@ -1130,5 +1104,7 @@
         students = self.portal_catalog(portal_type="Student")
         num_objects = len(students)
-        cached_data = self.fill_certificates_dict()
+        #cached_data = self.fill_certificates_dict()
+        if not hasattr(self,'_v_certificates'):
+            self._v_certificates = self.fill_certificates_dict()
         if pghandler:
             pghandler.init('Refreshing catalog: %s' % self.absolute_url(1), num_objects)
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')
+            
