Changeset 3098 for WAeUP_SRP/base/skins/waeup_utilities
- Timestamp:
- 4 Feb 2008, 08:58:20 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/skins/waeup_utilities/ti_71fc_resolve.py
r3084 r3098 29 29 aq_students = context.students_catalog.evalAdvancedQuery 30 30 aq_portal = context.portal_catalog_real.evalAdvancedQuery 31 course_results = context.course_results 32 aq_course_results = course_results.evalAdvancedQuery 31 33 students_folder = context.portal_url.getPortalObject().campus.students 32 34 … … 52 54 student_id = level.getPath().split('/')[-3] 53 55 students[student_id] = level.getId 54 56 course_results_to_change = [] 55 57 for student_id,level in students.items(): 56 58 study_course = getattr(getattr(students_folder,student_id),'study_course',None) … … 59 61 continue 60 62 #logger.info('%s renaming level' % (student_id)) 61 if level == '110': 62 if hasattr(study_course,'110'): 63 study_course.manage_renameObjects(('110',),('200',)) 64 logger.info('%s renamed level from 110 to 200' % (student_id)) 63 for level in ('110','210'): 64 if hasattr(study_course,level): 65 new_level = "%d" % (int(level) + 90) 66 study_course.manage_renameObjects((level,),(new_level,)) 67 logger.info('%s renamed level from %s to %s' % (student_id,level,new_level)) 68 query = Eq('student_id',student_id) & Eq('level_id',level) 69 results = aq_course_results(query) 70 if results: 71 for result in results: 72 d = {} 73 for field in course_results.schema(): 74 d[field] = getattr(result,field) 75 d['level_id'] = new_level 76 d['old_key'] = d['key'] 77 d['key'] = d['key'].replace(level,new_level) 78 course_results_to_change += d, 79 else: 80 logger.info('%s no course_results for %s' % (student_id,level)) 65 81 else: 66 logger.info('%s no level-object for 110' % (student_id)) 67 elif level == '210': 68 if hasattr(study_course,'210'): 69 study_course.manage_renameObjects(('210',),('300',)) 70 logger.info('%s renamed level from 110 to 200' % (student_id)) 71 else: 72 logger.info('%s no level-object for 210' % (student_id)) 82 logger.info('%s no level-object for %s' % (student_id,level)) 83 #set_trace() 84 for result in course_results_to_change: 85 try: 86 course_results.addRecord(**result) 87 logger.info('%(student_id)s adding %(key)s' % result) 88 except ValueError: 89 set_trace() 90 logger.info('%(student_id)s %(key)s already there' % result) 91 logger.info('%(student_id)s deleting %(old_key)s' % result) 92 course_results.deleteRecord(result['old_key']) 93 73 94 logger.info('finished')
Note: See TracChangeset for help on using the changeset viewer.