Changeset 2313
- Timestamp:
- 4 Oct 2007, 20:59:49 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/WAeUPTool.py
r2304 r2313 1003 1003 if getattr(self,'_v_departments',None) is None: 1004 1004 res = self.portal_catalog(portal_type = "Department") 1005 self._v_department s = {}1005 self._v_department_courses = {} 1006 1006 for d in res: 1007 self._v_department s[d.getId] = getattr(d.getObject(),"courses",None)1007 self._v_department_courses[d.getId] = getattr(d.getObject(),"courses",None) 1008 1008 did = mapping['department_code'] 1009 d = self._v_department s.get(did,None)1009 d = self._v_department_courses.get(did,None) 1010 1010 if d is None: 1011 1011 return '', "No Department with ID: %s" % did 1012 1012 course_id = mapping.get('code') 1013 1013 if course_id in self._v_course_list: 1014 return '', "Duplicate DepartmentID: %s" % did1014 return '', "Duplicate Course ID: %s" % did 1015 1015 c = getattr(d,course_id,None) 1016 1016 if c is not None: 1017 return '', "Duplicate DepartmentID: %s" % did1017 return '', "Duplicate Course ID: %s" % did 1018 1018 try: 1019 1019 d.invokeFactory('Course', course_id) … … 1042 1042 if getattr(self,'_v_certificate_list',None) is None: 1043 1043 self._v_certificate_list = [] 1044 if getattr(self,'_v_department s',None) is None:1044 if getattr(self,'_v_department_certificates',None) is None: 1045 1045 res = self.portal_catalog(portal_type = "Department") 1046 self._v_department s = {}1046 self._v_department_certificates = {} 1047 1047 for d in res: 1048 self._v_department s[d.getId] = getattr(d.getObject(),"certificates",None)1048 self._v_department_certificates[d.getId] = getattr(d.getObject(),"certificates",None) 1049 1049 did = mapping['department_code'] 1050 d = self._v_department s.get(did,None)1050 d = self._v_department_certificates.get(did,None) 1051 1051 if d is None: 1052 1052 return '', "No Department with ID: %s" % did 1053 1053 certificate_id = mapping.get('code') 1054 1054 if certificate_id in self._v_certificate_list: 1055 return '', "Duplicate DepartmentID: %s" % did1055 return '', "Duplicate Certificate ID: %s" % did 1056 1056 c = getattr(d,certificate_id,None) 1057 1057 if c is not None: 1058 return '', "Duplicate DepartmentID: %s" % did1058 return '', "Duplicate Certificate ID: %s" % did 1059 1059 try: 1060 1060 d.invokeFactory('Certificate', certificate_id)
Note: See TracChangeset for help on using the changeset viewer.