Changeset 3355 for WAeUP_SRP/base
- Timestamp:
- 19 Mar 2008, 15:20:40 (17 years ago)
- Location:
- WAeUP_SRP/base
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/WAeUPImport.py
r3347 r3355 244 244 departments = self.portal_catalog(portal_type = "Department") 245 245 self._v_department_certificates = {} 246 for d in departments: 247 certificates_folder = getattr(d.getObject(),"certificates",None) 248 self._v_department_certificates[d.getId] = certificates_folder.objectIds() 246 for department in departments: 247 certificates_container = getattr(department.getObject(),"certificates",None) 248 self._v_department_certificates[department.getId] = {'container': certificates_container, 249 'certificates': certificates_container.objectIds(), 250 } 249 251 department_id = mapping['department_code'] 250 252 msg = '' … … 255 257 msg = "No Department with ID: %s" % department_id 256 258 break 259 certificates_container = department_certificates['container'] 260 certificates = department_certificates['certificates'] 257 261 if certificate_id in self._v_certificate_list: 258 262 msg = "Duplicate Certificate ID: %s" % department_id 259 263 break 260 if certificate_id in department_certificates:264 if certificate_id in certificates: 261 265 msg = "Duplicate Certificate ID: %s" % department_id 262 266 break 263 267 try: 264 d.invokeFactory('Certificate', certificate_id)268 certificates_container.invokeFactory('Certificate', certificate_id) 265 269 except BadRequest,E: 266 270 msg = "%s" % E 267 271 break 268 272 self._v_certificate_list.append(certificate_id) 269 c = getattr(d,certificate_id)270 c .getContent().edit(mapping=mapping)273 certificate = getattr(certificates_container,certificate_id) 274 certificate.getContent().edit(mapping=mapping) 271 275 break 272 276 return certificate_id,msg,mapping … … 300 304 self._v_department_courses = {} 301 305 for department in departments: 302 courses_folder = getattr(department.getObject(),"courses",None) 303 if courses_folder is not None: 304 self._v_department_courses[department.getId] = courses_folder.objectIds() 306 courses_container = getattr(department.getObject(),"courses",None) 307 if courses_container is not None: 308 self._v_department_courses[department.getId] = {'container': courses_container, 309 'courses': courses_container.objectIds(), 310 } 305 311 department_id = mapping['department_code'] 306 312 course_id = mapping.get('code','') … … 311 317 msg = "no department with id: %(department_id)s" % vars() 312 318 break 319 courses_container = department_courses['container'] 320 courses = department_courses['courses'] 313 321 if course_id in self._v_course_list: 314 322 msg = "duplicate course id: %(course_id)s" % vars() 315 323 break 316 if course_id in department_courses:324 if course_id in courses: 317 325 msg = "course %(course_id)s already exists in department %(department_id)s" % vars() 318 326 break 319 327 try: 320 department.invokeFactory('Course', course_id)328 courses_container.invokeFactory('Course', course_id) 321 329 except BadRequest,E: 322 330 msg = "%s" % E 323 331 break 324 332 self._v_course_list.append(course_id) 325 course = getattr( department,course_id)333 course = getattr(courses_container,course_id) 326 334 course.getContent().edit(mapping=mapping) 327 335 break … … 332 340 course_id = mapping.get('code','') 333 341 course = self.courses_catalog.getRecordByKey(course_id) 342 msg = '' 334 343 while True: 335 344 if course is None: 336 345 msg = "no course with id: %s" % course_id 337 346 break 338 course_object = getattr(getattr(self.academics_folder,course.department),course_id) 347 course_object = getattr(getattr(getattr(getattr(self.academics_folder,course.faculty), 348 course.department), 349 'courses'), 350 course_id) 339 351 course_object.getContent().edit(mapping=mapping) 340 352 break -
WAeUP_SRP/base/Widgets.py
r3284 r3355 703 703 'Course', 704 704 'Certificate', 705 'CertificateCourse',]} 705 #'CertificateCourse', 706 ]} 706 707 widget_id = self.getWidgetId() 707 708 value = datastructure[widget_id] #.upper() is not necessary here because it's also done in waeup_document_create_do
Note: See TracChangeset for help on using the changeset viewer.