Changeset 3179
- Timestamp:
- 18 Feb 2008, 18:09:15 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/WAeUPImport.py
r3178 r3179 227 227 if getattr(self,'_v_course_list',None) is None: 228 228 self._v_course_list = [] 229 if getattr(self,'_v_department s',None) is None:230 res = self.portal_catalog(portal_type = "Department")229 if getattr(self,'_v_department_courses',None) is None: 230 departments = self.portal_catalog(portal_type = "Department") 231 231 self._v_department_courses = {} 232 for d in res: 233 self._v_department_courses[d.getId] = getattr(d.getObject(),"courses",None) 234 did = mapping['department_code'] 235 msg = '' 236 while True: 237 d = self._v_department_courses.get(did,None) 238 if d is None: 239 msg = "No Department with ID: %s" % did 240 break 241 course_id = mapping.get('code') 232 for department in departments: 233 courses_folder = getattr(department.getObject(),"courses",None) 234 if courses_folder is not None: 235 self._v_department_courses[department.getId] = courses_folder.objectIds() 236 department_id = mapping['department_code'] 237 course_id = mapping.get('code','') 238 msg = '' 239 while True: 240 department_courses = self._v_department_courses.get(department_id,None) 241 if department_courses is None: 242 msg = "No Department with ID: %(department_id)s" % vars() 243 break 242 244 if course_id in self._v_course_list: 243 msg = "Duplicate Course ID: %s" % did 244 break 245 c = getattr(d,course_id,None) 246 if c is not None: 247 msg = "Duplicate Course ID: %s" % did 245 msg = "Duplicate Course ID: %(course_id)s" % vars() 246 break 247 if course_id in department_courses: 248 msg = "Course %(course_id)s already exists in department %(department_id)s" % vars() 248 249 break 249 250 try: 250 d .invokeFactory('Course', course_id)251 department.invokeFactory('Course', course_id) 251 252 except BadRequest,E: 252 253 msg = "%s" % E 253 254 break 254 255 self._v_course_list.append(course_id) 255 c = getattr(d,course_id)256 c .getContent().edit(mapping=mapping)256 course = getattr(department,course_id) 257 course.getContent().edit(mapping=mapping) 257 258 break 258 259 return course_id,msg,mapping … … 260 261 261 262 def edit(self,mapping): ###( 262 course_id = mapping.get('code' )263 course_id = mapping.get('code','') 263 264 res = self.portal_catalog(id=course_id) 264 265 while True: … … 644 645 jamb_reg_no = mapping.get('jamb_reg_no',None) 645 646 msg = '' 647 student_id = '' 646 648 while True: 647 649 if jamb_reg_no: … … 694 696 self.portal_workflow.doActionFor(student_obj,transition) 695 697 student_obj.manage_setLocalRoles(student_id, ['Owner',]) 698 mapping['id'] = student_id 696 699 break 697 700 return student_id,msg,mapping 698 701 ###) 699 702 700 def edit(self,mapping): 703 def edit(self,mapping): ###( 701 704 wftool = self.portal_workflow 702 705 "edit student records due import" … … 815 818 return student_id,msg,mapping 816 819 ###) 820 ###) 817 821 818 822 class VerdictImport(WAeUPImport):###(
Note: See TracChangeset for help on using the changeset viewer.