Index: /WAeUP_SRP/base/skins/waeup_student/getStudentFolderInfo.py
===================================================================
--- /WAeUP_SRP/base/skins/waeup_student/getStudentFolderInfo.py	(revision 2805)
+++ /WAeUP_SRP/base/skins/waeup_student/getStudentFolderInfo.py	(revision 2806)
@@ -23,4 +23,9 @@
 import logging
 logger = logging.getLogger('Skins.getStudentFolderInfo')
+from Products.AdvancedQuery import Eq, Between, Le,In
+try:
+    aq_portal = context.portal_catalog.evalAdvancedQuery
+except:
+    aq_portal = context.portal_catalog_real.evalAdvancedQuery
 
 
@@ -47,11 +52,16 @@
 student_path_root = "%s/campus/students/%s" % (context.portal_url.getPortalPath(),student_id)
 student_path = "%s/campus/students/%s" % (context.portal_url(),student_id)
-res = context.students_catalog(id = student_id)
-if not res:
+students_folder = context.portal_url.getPortalObject().campus.students
+# res = context.students_catalog(id = student_id)
+# if not res:
+#     return None
+# student_record = res[0]
+student_record = context.students_catalog.getRecordByKey(student_id)
+if student_record is None:
     return None
-st_brain = res[0]
+    
 #from Products.zdb import set_trace;set_trace()
 for field in context.students_catalog.schema():
-    info[field] = getattr(st_brain,field)
+    info[field] = getattr(student_record,field)
 
 #res = context.portal_catalog(portal_type='Student',id = student_id)
@@ -59,13 +69,13 @@
 #    info['review_state'] = res[0].review_state
 
-info['review_state'] = context.getStudentReviewState()
+#info['review_state'] = context.getStudentReviewState()
 
 info['session'] = False
-if st_brain.matric_no:
-    res = context.results_import(matric_no = st_brain.matric_no)
+if student_record.matric_no:
+    res = context.results_import(matric_no = student_record.matric_no)
     if res:
        info['session'] = True
 
-info['base_info'] = context.getFormattedStudentEntry(st_brain) 
+info['base_info'] = context.getFormattedStudentEntry(student_record) 
 
 info['id'] = student_id
@@ -85,24 +95,50 @@
 #logger.info("before search")
 starttime = DateTime.DateTime().timeTime()
-sos = context.portal_catalog(container_path=student_path_root)
+#sos = context.portal_catalog(container_path=student_path_root)
+# query = Eq('container_path',student_path_root)
+# sos = aq_portal(query)
+# logger.info("searchtime %f" % (DateTime.DateTime().timeTime() - starttime))
+# starttime = DateTime.DateTime().timeTime()
+# for so in sos:
+#     row = {}
+#     row['id'] = so.getId
+#     row['title'] = so.Title
+#     url = row['url'] = "%s/%s" % (student_path,so.getId)
+#     row['type'] = so.portal_type
+#     review_state = row['review_state'] = so.review_state
+#     row['is_editable'] = (is_student and review_state == "opened") or is_sectionofficer
+#     sv_link = s_view_links.get(so.portal_type,None) or "waeup_document_view"
+#     row['s_view_link'] = "%s/%s" % (url,sv_link)
+#     se_link = s_edit_links.get(so.portal_type,None)
+#     row['s_edit_link'] = None
+#     if se_link:
+#         row['s_edit_link'] = "%s/%s" % (url,se_link)
+#     row['display'] = review_state in ('opened','closed','bed_reserved','maintenance_fee_paid',)\
+#                     and so.portal_type not in  ('StudentPume','StudentAccommodation','PaymentsFolder',) or\
+#                     so.portal_type == 'StudentStudyCourse'
+#     items.append(row)
+starttime = DateTime.DateTime().timeTime()
+#sos = context.portal_catalog(container_path=student_path_root)
+student_obj = getattr(students_folder,student_id)
+subobjects = student_obj.objectValues()
 logger.info("searchtime %f" % (DateTime.DateTime().timeTime() - starttime))
 starttime = DateTime.DateTime().timeTime()
-for so in sos:
+for subobject in subobjects:
     row = {}
-    row['id'] = so.getId
-    row['title'] = so.Title
-    url = row['url'] = "%s/%s" % (student_path,so.getId)
-    row['type'] = so.portal_type
-    review_state = row['review_state'] = so.review_state
+    row['id'] = subobject.getId()
+    row['title'] = subobject.Title
+    url = row['url'] = subobject.absolute_url()
+    row['type'] = subobject.portal_type
+    review_state = row['review_state'] = wf.getInfoFor(subobject,'review_state',None)
     row['is_editable'] = (is_student and review_state == "opened") or is_sectionofficer
-    sv_link = s_view_links.get(so.portal_type,None) or "waeup_document_view"
+    sv_link = s_view_links.get(subobject.portal_type,None) or "waeup_document_view"
     row['s_view_link'] = "%s/%s" % (url,sv_link)
-    se_link = s_edit_links.get(so.portal_type,None)
+    se_link = s_edit_links.get(subobject.portal_type,None)
     row['s_edit_link'] = None
     if se_link:
         row['s_edit_link'] = "%s/%s" % (url,se_link)
     row['display'] = review_state in ('opened','closed','bed_reserved','maintenance_fee_paid',)\
-                    and so.portal_type not in  ('StudentPume','StudentAccommodation','PaymentsFolder',) or\
-                    so.portal_type == 'StudentStudyCourse'
+                    and subobject.portal_type not in  ('StudentPume','StudentAccommodation','PaymentsFolder',) or\
+                    subobject.portal_type == 'StudentStudyCourse'
     items.append(row)
 logger.info("listtime %f" % (DateTime.DateTime().timeTime() - starttime))
