Changeset 2454 for WAeUP_SRP/base
- Timestamp:
- 27 Oct 2007, 21:53:04 (17 years ago)
- Location:
- WAeUP_SRP/base
- Files:
-
- 2 added
- 1 deleted
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/Accommodation.py
r2443 r2454 196 196 accommodation.modifyRecord(bed=already[0].bed,student='') 197 197 student_obj = getattr(students_folder, student.id) 198 acco_id = "accommodation_%s" % self.getSessionId() 198 acco_id = "accommodation_%s" % self.getSessionId()[0] 199 199 if acco_id in student_obj.objectIds(): 200 200 acco_doc = getattr(student_obj, acco_id).getContent() -
WAeUP_SRP/base/Students.py
r2128 r2454 353 353 da["jamb_middlename"] = middlename 354 354 da["jamb_lastname"] = lastname 355 catalog_entry['entry_session'] = da["entry_session"] = self.getSessionId()[ -2:]355 catalog_entry['entry_session'] = da["entry_session"] = self.getSessionId()[0] 356 356 catalog_entry['sex'] = sex = result.get(csv_d['jamb_sex']).startswith('F') 357 357 da_fields = ('jamb_reg_no', -
WAeUP_SRP/base/WAeUPTables.py
r2448 r2454 985 985 import_record.Lastname) 986 986 data['jamb_reg_no'] = import_record.Entryregno 987 if reindex_special and 'registered_courses' in reindex_special:988 try:989 study_course = getattr(student_object,"study_course")990 level_ids = study_course.objectIds()991 except:992 continue993 if not level_ids:994 continue995 modified = True996 level_ids.sort()997 course_ids = getattr(study_course,level_ids[-1]).objectIds()998 courses = []999 for c in course_ids:1000 if c.endswith('_co'):1001 courses.append(c[:-3])1002 else:1003 courses.append(c)1004 data['registered_courses'] = courses987 #if reindex_special and 'registered_courses' in reindex_special: 988 # try: 989 # study_course = getattr(student_object,"study_course") 990 # level_ids = study_course.objectIds() 991 # except: 992 # continue 993 # if not level_ids: 994 # continue 995 # modified = True 996 # level_ids.sort() 997 # course_ids = getattr(study_course,level_ids[-1]).objectIds() 998 # courses = [] 999 # for c in course_ids: 1000 # if c.endswith('_co'): 1001 # courses.append(c[:-3]) 1002 # else: 1003 # courses.append(c) 1004 # data['registered_courses'] = courses 1005 1005 if modified: 1006 1006 self.modifyRecord(**data) … … 1052 1052 import_record.Lastname) 1053 1053 data['jamb_reg_no'] = import_record.Entryregno 1054 else:1055 study_course = getattr(student_object,'study_course',None)1056 current_level = data.get('level',None)1057 data['registered_courses'] = []1058 if study_course and current_level and current_level in study_course.objectIds():1059 level_obj = getattr(study_course,current_level)1060 courses = []1061 for c in level_obj.objectIds():1062 if c.endswith('_co'):1063 courses.append(c[:-3])1064 else:1065 courses.append(c)1066 data['registered_courses'] = courses1054 #else: 1055 # study_course = getattr(student_object,'study_course',None) 1056 # current_level = data.get('level',None) 1057 # data['registered_courses'] = [] 1058 # if study_course and current_level and current_level in study_course.objectIds(): 1059 # level_obj = getattr(study_course,current_level) 1060 # courses = [] 1061 # for c in level_obj.objectIds(): 1062 # if c.endswith('_co'): 1063 # courses.append(c[:-3]) 1064 # else: 1065 # courses.append(c) 1066 # data['registered_courses'] = courses 1067 1067 self.addRecord(**data) 1068 1068 if pghandler: pghandler.finish() … … 1097 1097 self.deleteRecord(student_id) 1098 1098 #import pdb;pdb.set_trace() 1099 elif pt == 'StudentCourseResult' and mt == 'CPS Proxy Folder':1100 if event_type not in ("sys_add_object","sys_del_object"):1101 return1102 level_session = getattr(object.aq_parent.getContent(),'session','unknown')1103 if level_session not in (self.getSessionId()[-2:],'2006/2007'):1104 return1105 course_id = object.getId()1106 if course_id.endswith('_co'):1107 course_id = course_id[:-3]1108 student_id = object.absolute_url_path().split('/')[-4]1109 res = students_catalog(id = student_id)1110 if not res:1111 return1112 student_rec = res[0]1113 registered_courses = getattr(student_rec,'registered_courses',None)1114 if not registered_courses:1115 registered_courses = []1116 if event_type == "sys_add_object":1117 if course_id not in registered_courses:1118 registered_courses.append(course_id)1119 else:1120 return1121 elif registered_courses and event_type == "sys_del_object":1122 removed = False1123 while course_id in registered_courses:1124 removed = True1125 registered_courses.remove(course_id)1126 if not removed:1127 return1128 data['id'] = student_id1129 data['registered_courses'] = registered_courses1130 self.modifyRecord(record = student_rec, **data)1131 return1099 #elif pt == 'StudentCourseResult' and mt == 'CPS Proxy Folder': 1100 # if event_type not in ("sys_add_object","sys_del_object"): 1101 # return 1102 # level_session = getattr(object.aq_parent.getContent(),'session','unknown') 1103 # if level_session not in (self.getSessionId()[-2:],'2006/2007'): 1104 # return 1105 # course_id = object.getId() 1106 # if course_id.endswith('_co'): 1107 # course_id = course_id[:-3] 1108 # student_id = object.absolute_url_path().split('/')[-4] 1109 # res = students_catalog(id = student_id) 1110 # if not res: 1111 # return 1112 # student_rec = res[0] 1113 # registered_courses = getattr(student_rec,'registered_courses',None) 1114 # if not registered_courses: 1115 # registered_courses = [] 1116 # if event_type == "sys_add_object": 1117 # if course_id not in registered_courses: 1118 # registered_courses.append(course_id) 1119 # else: 1120 # return 1121 # elif registered_courses and event_type == "sys_del_object": 1122 # removed = False 1123 # while course_id in registered_courses: 1124 # removed = True 1125 # registered_courses.remove(course_id) 1126 # if not removed: 1127 # return 1128 # data['id'] = student_id 1129 # data['registered_courses'] = registered_courses 1130 # self.modifyRecord(record = student_rec, **data) 1131 # return 1132 1132 if pt not in self.affected_types.keys(): 1133 1133 return -
WAeUP_SRP/base/WAeUPTool.py
r2436 r2454 458 458 459 459 entry_session = dict.get('entry_session') 460 if entry_session == self.getSessionId()[ -2:]:460 if entry_session == self.getSessionId()[0]: 461 461 wfaction = 'admit' 462 462 wft = 'wf_transition_admit' … … 554 554 level = "%d00" % lnr 555 555 verdict,eligible = self.getVerdict(s_results[0].Verdict) 556 if eligible:557 level = "%d00" % (lnr + 1)556 #if eligible: 557 # level = "%d00" % (lnr + 1) 558 558 else: 559 559 logger.info('matric_no %s not found in results_import' % student.matric_no) … … 579 579 da['jamb_reg_no'] = student.Entryregno 580 580 em = self.getEntryMode(student.Entryregno) 581 ## em = student.Mode_of_Entry582 ## if em in ('DIRECT', 'DIRECT ENTRY',):583 ## em = 'DE'584 ## elif em in ('U.M.E', 'UNE',):585 ## em = 'UME'586 ## elif not em:587 ## em = "unknown"588 581 da['entry_mode'] = em 589 582 personal = student_obj.personal … … 616 609 clearance.getContent().edit(mapping=dc) 617 610 self.portal_workflow.doActionFor(clearance,'close',dest_container=clearance) 618 ## catd = {}619 ## catd['id'] = sid620 ## catd['entry_mode']= da['entry_mode']621 ## catd['matric_no'] = matric_no622 ## catd['jamb_reg_no'] = da['jamb_reg_no']623 ## catd['name'] = "%(firstname)s %(middlename)s %(lastname)s" % dp624 ## catd['sex'] = dp['sex']625 ## catd['level'] = level626 ## catd['verdict'] = verdict627 ## if certificate_brain:628 ## cpath = certificate_brain.getPath().split('/')629 ## catd['faculty'] = cpath[-4]630 ## catd['department'] = cpath[-3]631 ## catd['course'] = certcode632 ## self.students_catalog.modifyRecord(**catd)633 611 # 634 612 # Study Course … … 1295 1273 for field in f2t[pt]['fields']: 1296 1274 d[field] = mapping.get(field,'') 1297 1298 if pt == "StudentApplication": 1275 1276 if pt == "StudentApplication": 1299 1277 d['jamb_sex'] = 'M' 1300 1278 if mapping.get('sex'): -
WAeUP_SRP/base/Widgets.py
r2433 r2454 277 277 v = value = '0%c' % v 278 278 elif not value: 279 v = value = self.getSessionId()[ -2:]279 v = value = self.getSessionId()[0] 280 280 #import pdb;pdb.set_trace() 281 281 sessions = self._getSessions() -
WAeUP_SRP/base/skins/cps_custom/config_form.pt
r2288 r2454 71 71 <tr> 72 72 <th> 73 <label> 74 Current Session 75 </label> 76 </th> 77 <td> 78 <input name="session" id="portal_session" value="" 79 tal:attributes="value pprops/session" /> 80 </td> 81 </tr> 82 <tr> 83 <th> 73 84 <label for="portal_description" 74 85 i18n:translate="label_portal_description"> -
WAeUP_SRP/base/skins/waeup_accommodation/allocate_reserved_bed.py
r1566 r2454 64 64 students = context.portal_url.getPortalObject().campus.students 65 65 student_obj = getattr(students,sid) 66 acco_id = "accommodation_%s" % context.getSessionId() 66 acco_id = "accommodation_%s" % context.getSessionId()[0] 67 67 while True: 68 68 if not res: -
WAeUP_SRP/base/skins/waeup_accommodation/change_bed.py
r2000 r2454 60 60 return redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id'])) 61 61 student_obj = getattr(students,student_id) 62 acco_id = "accommodation_%s" % context.getSessionId() 62 acco_id = "accommodation_%s" % context.getSessionId()[0] 63 63 if acco_id in student_obj.objectIds(): 64 64 acco_doc = getattr(student_obj, acco_id).getContent() -
WAeUP_SRP/base/skins/waeup_accommodation/getAccommodationInfo.py
r2427 r2454 80 80 booking_allowed = info['verdict'] in ("A", 81 81 "B",) 82 82 83 83 booking_allowed = False # booking temporarily disabled 84 84 # the algorithm must be adapted to new course_results catalog 85 85 # and/or FCEOkene modalities 86 87 88 89 90 91 92 93 94 86 87 95 88 info['booking_allowed'] = booking_allowed 96 89 if not booking_allowed: 97 90 info['acco'] = None 98 91 return info 99 acco_id = 'accommodation_2006' 92 info['session'] = session = context.getSessionId() 93 acco_id = 'accommodation_' + session[0] 100 94 acco = getattr(student,acco_id,None) 101 95 info['acco'] = acco -
WAeUP_SRP/base/skins/waeup_accommodation/reserve_accommodation.py
r2000 r2454 27 27 student = info['student'] 28 28 acco_id = info['acco_id'] 29 session = acco_id[-4:] 29 session = info['session'][1] 30 #session = acco_id[-4:] 30 31 validate = REQUEST.has_key("cpsdocument_create_button") 31 32 if info.has_key('acco') and info['acco']: -
WAeUP_SRP/base/skins/waeup_default/getSessionId.py
r2133 r2454 15 15 # must be changed in 2007/2008; should return only the last two digits 16 16 17 import DateTime 18 now = DateTime.DateTime() 19 if now.month() > 11: 20 s = "%s" % now.year() 21 else: 22 s = "%s" % (now.year() - 1) 23 return s 17 #import DateTime 18 #now = DateTime.DateTime() 19 #if now.month() > 11: 20 # s = "%s" % now.year() 21 #else: 22 # s = "%s" % (now.year() - 1) 23 #return s 24 25 session_id = context.portal_properties.session[2:4] 26 session_str = context.portal_properties.session 27 28 return [session_id, session_str] -
WAeUP_SRP/base/skins/waeup_epayment/getPaymentsFolderInfo.py
r2249 r2454 71 71 info['prod_id'] = '61' 72 72 session = s_brain.session 73 info['next_session'], info['next_session_str'] = context.getNextSessionId(session) 73 next_info = context.getNextInfo(s_brain) 74 info['next_session'] = next_info['next_session_id'] 75 info['next_session_str'] = next_info['next_session_str'] 74 76 75 77 info['student_name'] = s_brain.name -
WAeUP_SRP/base/skins/waeup_epayment/interswitch_cb.py
r2135 r2454 52 52 pd[pdk] = request.get(rc,'') 53 53 54 # for testing purposes54 ## for testing purposes 55 55 #pd['resp_desc'] = 'Simulated Callback' 56 56 #pd['resp_pay_reference'] = 'XXXX' … … 74 74 s_brain = context.students_catalog(id=student_id)[0] 75 75 session = s_brain.session 76 next_session, next_session_str = context.getNextSessionId(session) 76 #next_session, next_session_str = context.getNextSessionId(session) 77 78 next_info = context.getNextInfo(s_brain) 79 next_session_id = next_info['next_session_id'] 80 next_session_str = next_info['next_session_str'] 81 next_level_id = next_info['next_level_id'] 82 next_transition = next_info['next_transition'] 77 83 78 84 if resp == '00': … … 80 86 logger.info('%s paid school_fee in state school_fee_paid' % (student_id)) 81 87 else: 82 if next_session == context.getSessionId()[-2:]: 83 wftool.doActionFor(student,'pay_school_fee') 84 else: 85 study_course = getattr(student,'study_course') 86 try: 87 wftool.doActionFor(study_course,'open') 88 except: 89 pass 90 study_course_doc = study_course.getContent() 91 next_level = "%s" % (int(s_brain.level) + 100) 92 study_course_doc.edit(mapping= {'current_level': next_level, 93 'current_session': next_session,}) 88 study_course = getattr(student,'study_course') 89 try: 90 wftool.doActionFor(study_course,'open') 91 except: 92 pass 93 study_course.getContent().edit(mapping= {'current_level': next_level_id, 94 'current_session': next_session_id,}) 95 if next_transition: 96 wftool.doActionFor(student,next_transition) 97 94 98 logger.info('%s received valid callback' % student_id) 95 99 referer = request.get('HTTP_REFERER','none') -
WAeUP_SRP/base/skins/waeup_epayment/pay_by_sc.py
r2451 r2454 24 24 if context.portal_membership.isAnonymousUser(): 25 25 return None 26 26 wftool = context.portal_workflow 27 27 lt = context.portal_layouts 28 28 request = context.REQUEST … … 34 34 student = getattr(students,student_id) 35 35 s_brain = context.students_catalog(id=student_id)[0] 36 next_info = context.getNextInfo(s_brain)37 next_session_id = next_info['next_session_id']38 next_session_str = next_info['next_session_str']39 next_level_id = next_info['next_level_id']40 next_transition = next_info['next_transition']41 study_course = getattr(student,'study_course')42 study_course.getContent().edit(mapping= {'current_level': next_level_id,43 'current_session': next_session_id,})44 if next_transition:45 wftool.doActionFor(student,next_transition)46 36 47 37 # session = s_brain.session 48 38 # next_session, next_session_str = context.getNextSessionId(session) 49 # validate = request.has_key("cpsdocument_create_button") 39 40 next_info = context.getNextInfo(s_brain) 41 next_session_id = next_info['next_session_id'] 42 next_session_str = next_info['next_session_str'] 43 next_level_id = next_info['next_level_id'] 44 next_transition = next_info['next_transition'] 45 46 validate = request.has_key("cpsdocument_create_button") 50 47 res,psm,ds = lt.renderLayout(layout_id= 'student_schoolfee', 51 48 schema_id= 'payment', … … 113 110 payment.getContent().edit(mapping=info) 114 111 wftool.doActionFor(payment,'close') 115 if next_session == context.getSessionId()[-2:]: 116 wftool.doActionFor(student,'pay_school_fee') 117 else: 118 study_course = getattr(student,'study_course') 119 #wftool.doActionFor(study_course,'open') 120 study_course_doc = study_course.getContent() 121 next_level = "%s" % (int(s_brain.level) + 100) 122 study_course_doc.edit(mapping= {'current_level': next_level, 123 'current_session': next_session,}) 112 113 study_course = getattr(student,'study_course') 114 study_course.getContent().edit(mapping= {'current_level': next_level_id, 115 'current_session': next_session_id,}) 116 if next_transition: 117 wftool.doActionFor(student,next_transition) 118 119 #if next_session == context.getSessionId()[-2:]: 120 # wftool.doActionFor(student,'pay_school_fee') 121 #else: 122 # study_course = getattr(student,'study_course') 123 # #wftool.doActionFor(study_course,'open') 124 # study_course_doc = study_course.getContent() 125 # next_level = "%s" % (int(s_brain.level) + 100) 126 # study_course_doc.edit(mapping= {'current_level': next_level, 127 # 'current_session': next_session,}) 128 124 129 logger.info('%s paid school fee by scratch card' % student_id) 125 130 else: -
WAeUP_SRP/base/skins/waeup_student/create_level.py
r2448 r2454 72 72 results = context.results_import(matric_no = student.matric_no) 73 73 records = [] 74 if results: 75 l = [] 74 l = [] 75 if student.session in ('6', '06') and results: 76 76 carry_overs = results 77 77 for co in carry_overs: … … 154 154 logger.info('%s finished to create level %s' % (student.id,current_level)) 155 155 156 if current_session == '05':157 next_session = '06'158 next_level = "%s" % (int(current_level) + 100)159 study_course = getattr(student,'study_course')160 context.portal_workflow.doActionFor(study_course,'open')161 study_course_doc = study_course.getContent()162 study_course_doc.edit(mapping= {'current_level': next_level,163 'current_session': next_session,})164 context.portal_workflow.doActionFor(study_course,'close_for_edit')156 #if current_session == '05': 157 # next_session = '06' 158 # next_level = "%s" % (int(current_level) + 100) 159 # study_course = getattr(student,'study_course') 160 # context.portal_workflow.doActionFor(study_course,'open') 161 # study_course_doc = study_course.getContent() 162 # study_course_doc.edit(mapping= {'current_level': next_level, 163 # 'current_session': next_session,}) 164 # context.portal_workflow.doActionFor(study_course,'close_for_edit') 165 165 166 166 return response.redirect("%s/%s" % (context.absolute_url(),current_level)) -
WAeUP_SRP/base/skins/waeup_student/getNextInfo.py
r2451 r2454 1 ## Script (Python) "get SessionId"1 ## Script (Python) "getNextInfo" 2 2 ##bind container=container 3 3 ##bind context=context … … 12 12 return the students next info 13 13 """ 14 14 15 info = {} 16 17 session_id = student_brain.session 18 level_id = student_brain.level 19 review_state = student_brain.review_state 20 verdict = student_brain.verdict 15 21 info['next_transition'] = None 16 session_id = student_brain.session 17 if int(session_id) > int(context.getSessionId()[3:4]) -2: 22 info['next_session_id'] = next_session_id = session_id 23 info['next_level_id'] = next_level_id = level_id 24 25 if review_state == 'cleared_and_validated': 18 26 info['next_transition'] = "pay_school_fee" 27 elif review_state == 'returning': 28 info['next_level_id'] = "%s" % (int(level_id) + 100) 29 info['next_session_id'] = next_session_id = "%02d" % (int(session_id)+1) 30 if int(session_id) > int(context.getSessionId()[0]) -2: 31 info['next_transition'] = "pay_school_fee" 32 if verdict not in ('A','B',): 33 info['next_level_id'] = level_id 19 34 20 if student_brain.review_state == "returning": 21 session_id info['next_session_id'] = "%02d" % int(session_id) + 1 22 info['next_session_str'] = context.session_voc(session_id) 23 next_level_id = student_brain.level 24 if student_brain.review_state not in ('cleared_and_validated',) 25 next_level_id = "%s" % (int(next_level_id) + 100) 26 info['next_level_id'] = next_level_id 27 35 info['next_session_str'] = context.sessions_voc(next_session_id) 28 36 29 37 return info -
WAeUP_SRP/base/skins/waeup_student/getStudyLevelInfo.py
r2451 r2454 97 97 info['credits_exceeded'] = credits_total > 51 98 98 current_session = student.session 99 info['submission_allowed']= not info['credits_exceeded'] and current_session == context.getSessionId()[ -2:]99 info['submission_allowed']= not info['credits_exceeded'] and current_session == context.getSessionId()[0] 100 100 # carry_overs.sort(cmp_semester_id) 101 101 info['carry_overs'] = carry_overs -
WAeUP_SRP/base/skins/waeup_utilities/fixReservedBeds.py
r1567 r2454 17 17 students = context.portal_url.getPortalObject().campus.students 18 18 hostels = context.portal_url.getPortalObject().campus.accommodation.objectItems() 19 acco_id = "accommodation_%s" % context.getSessionId() 19 acco_id = "accommodation_%s" % context.getSessionId()[0] 20 20 logger.info('%s starts fixReservedBeds' % (member)) 21 21 #from Products.zdb import set_trace;set_trace() -
WAeUP_SRP/base/skins/waeup_utilities/fixReturningSession.py
r2453 r2454 36 36 brains = aq_students(query) 37 37 total = len(brains) 38 logger.info('editet %d students with session 06 and returning' % total)38 logger.info('editet %d students with session 06 and state returning' % total) 39 39 count = 0 40 40 commit_after = 100 … … 55 55 except: 56 56 rwrite('>>>> not found %s study_course' % (brain.id)) 57 57
Note: See TracChangeset for help on using the changeset viewer.