Changeset 2806 for WAeUP_SRP/base/skins
- Timestamp:
- 28 Nov 2007, 09:00:07 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/skins/waeup_student/getStudentFolderInfo.py
r2745 r2806 23 23 import logging 24 24 logger = logging.getLogger('Skins.getStudentFolderInfo') 25 from Products.AdvancedQuery import Eq, Between, Le,In 26 try: 27 aq_portal = context.portal_catalog.evalAdvancedQuery 28 except: 29 aq_portal = context.portal_catalog_real.evalAdvancedQuery 25 30 26 31 … … 47 52 student_path_root = "%s/campus/students/%s" % (context.portal_url.getPortalPath(),student_id) 48 53 student_path = "%s/campus/students/%s" % (context.portal_url(),student_id) 49 res = context.students_catalog(id = student_id) 50 if not res: 54 students_folder = context.portal_url.getPortalObject().campus.students 55 # res = context.students_catalog(id = student_id) 56 # if not res: 57 # return None 58 # student_record = res[0] 59 student_record = context.students_catalog.getRecordByKey(student_id) 60 if student_record is None: 51 61 return None 52 st_brain = res[0] 62 53 63 #from Products.zdb import set_trace;set_trace() 54 64 for field in context.students_catalog.schema(): 55 info[field] = getattr(st _brain,field)65 info[field] = getattr(student_record,field) 56 66 57 67 #res = context.portal_catalog(portal_type='Student',id = student_id) … … 59 69 # info['review_state'] = res[0].review_state 60 70 61 info['review_state'] = context.getStudentReviewState()71 #info['review_state'] = context.getStudentReviewState() 62 72 63 73 info['session'] = False 64 if st _brain.matric_no:65 res = context.results_import(matric_no = st _brain.matric_no)74 if student_record.matric_no: 75 res = context.results_import(matric_no = student_record.matric_no) 66 76 if res: 67 77 info['session'] = True 68 78 69 info['base_info'] = context.getFormattedStudentEntry(st _brain)79 info['base_info'] = context.getFormattedStudentEntry(student_record) 70 80 71 81 info['id'] = student_id … … 85 95 #logger.info("before search") 86 96 starttime = DateTime.DateTime().timeTime() 87 sos = context.portal_catalog(container_path=student_path_root) 97 #sos = context.portal_catalog(container_path=student_path_root) 98 # query = Eq('container_path',student_path_root) 99 # sos = aq_portal(query) 100 # logger.info("searchtime %f" % (DateTime.DateTime().timeTime() - starttime)) 101 # starttime = DateTime.DateTime().timeTime() 102 # for so in sos: 103 # row = {} 104 # row['id'] = so.getId 105 # row['title'] = so.Title 106 # url = row['url'] = "%s/%s" % (student_path,so.getId) 107 # row['type'] = so.portal_type 108 # review_state = row['review_state'] = so.review_state 109 # row['is_editable'] = (is_student and review_state == "opened") or is_sectionofficer 110 # sv_link = s_view_links.get(so.portal_type,None) or "waeup_document_view" 111 # row['s_view_link'] = "%s/%s" % (url,sv_link) 112 # se_link = s_edit_links.get(so.portal_type,None) 113 # row['s_edit_link'] = None 114 # if se_link: 115 # row['s_edit_link'] = "%s/%s" % (url,se_link) 116 # row['display'] = review_state in ('opened','closed','bed_reserved','maintenance_fee_paid',)\ 117 # and so.portal_type not in ('StudentPume','StudentAccommodation','PaymentsFolder',) or\ 118 # so.portal_type == 'StudentStudyCourse' 119 # items.append(row) 120 starttime = DateTime.DateTime().timeTime() 121 #sos = context.portal_catalog(container_path=student_path_root) 122 student_obj = getattr(students_folder,student_id) 123 subobjects = student_obj.objectValues() 88 124 logger.info("searchtime %f" % (DateTime.DateTime().timeTime() - starttime)) 89 125 starttime = DateTime.DateTime().timeTime() 90 for s o in sos:126 for subobject in subobjects: 91 127 row = {} 92 row['id'] = s o.getId93 row['title'] = s o.Title94 url = row['url'] = "%s/%s" % (student_path,so.getId)95 row['type'] = s o.portal_type96 review_state = row['review_state'] = so.review_state128 row['id'] = subobject.getId() 129 row['title'] = subobject.Title 130 url = row['url'] = subobject.absolute_url() 131 row['type'] = subobject.portal_type 132 review_state = row['review_state'] = wf.getInfoFor(subobject,'review_state',None) 97 133 row['is_editable'] = (is_student and review_state == "opened") or is_sectionofficer 98 sv_link = s_view_links.get(s o.portal_type,None) or "waeup_document_view"134 sv_link = s_view_links.get(subobject.portal_type,None) or "waeup_document_view" 99 135 row['s_view_link'] = "%s/%s" % (url,sv_link) 100 se_link = s_edit_links.get(s o.portal_type,None)136 se_link = s_edit_links.get(subobject.portal_type,None) 101 137 row['s_edit_link'] = None 102 138 if se_link: 103 139 row['s_edit_link'] = "%s/%s" % (url,se_link) 104 140 row['display'] = review_state in ('opened','closed','bed_reserved','maintenance_fee_paid',)\ 105 and s o.portal_type not in ('StudentPume','StudentAccommodation','PaymentsFolder',) or\106 s o.portal_type == 'StudentStudyCourse'141 and subobject.portal_type not in ('StudentPume','StudentAccommodation','PaymentsFolder',) or\ 142 subobject.portal_type == 'StudentStudyCourse' 107 143 items.append(row) 108 144 logger.info("listtime %f" % (DateTime.DateTime().timeTime() - starttime))
Note: See TracChangeset for help on using the changeset viewer.