Changeset 1549
- Timestamp:
- 15 Mar 2007, 09:01:02 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/PatchCPSUserFolderUserFolder.py
r1548 r1549 78 78 break 79 79 80 80 #from pdb import set_trace;set_trace() 81 81 # can be later simplified by replacing by students_catalog values - Henrik 82 82 # getattr works always because of acquisition ?! Henrik … … 85 85 break 86 86 sc_obj = sc.getContent() 87 res_sc = self.portal_catalog(portal_type="Certificate",88 id = sc_obj.study_course)89 if len(res_ sc) != 1:87 cert_id = sc_obj.study_course 88 res_cert = self.portal_catalog(id = cert_id) 89 if len(res_cert) != 1: 90 90 break 91 cert_path = res_sc[0].getPath().split('/') 91 certificate_brain = res_cert[0] 92 certificate_obj = certificate_brain.getObject() 93 cert_path = certificate_brain.getPath().split('/') 92 94 fac_id = cert_path[-4] 93 95 dep_id = cert_path[-3] … … 98 100 if len(res) != 1: 99 101 break 100 self.students_catalog.modifyRecord(id = student_id, 102 st_entry = res[0] 103 if st_entry.faculty != fac_id or\ 104 st_entry.department != dep_id or\ 105 st_entry.course != cert_id: 106 self.students_catalog.modifyRecord(id = student_id, 101 107 faculty = fac_id, 102 108 department = dep_id, 103 course = sc_obj.study_course,109 course = cert_id 104 110 ) 105 106 107 res = self.portal_catalog(portal_type="Department",id=dep_id) 108 if len(res) != 1: 109 break 110 dynamic_roles = self.getRolesInContext(res[0].getObject()) 111 for dr in ('ClearanceOfficer','CourseAdviser', 'SectionManager'): 111 if real_object.portal_type == "StudentStudyLevel": 112 context_obj = getattr(certificate_obj,real_object.getId()) 113 allowed = ('CourseAdviser', 'SectionManager') 114 else: 115 res = self.portal_catalog(portal_type="Department",id=dep_id) 116 allowed = ('ClearanceOfficer', 'SectionManager') 117 if len(res) != 1: 118 break 119 context_obj = res[0].getObject() 120 dynamic_roles = self.getRolesInContext(context_obj) 121 for dr in allowed: 112 122 if dr in dynamic_roles: 113 123 roles.append(dr)
Note: See TracChangeset for help on using the changeset viewer.