Changeset 1728 for WAeUP_SRP/trunk/WAeUPTool.py
- Timestamp:
- 3 May 2007, 07:54:44 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/WAeUPTool.py
r1721 r1728 63 63 ) 64 64 65 student_field2types = { ###( 66 'StudentApplication': 67 {'id': 'application', 68 'title': 'Application Data', 69 'fields': 70 ('jamb_reg_no', 71 'entry_mode', 72 'entry_level', 73 'entry_session', 74 'jamb_score', 75 'email', 76 'phone', 77 ) 78 }, 79 'StudentPume': 80 {'id': 'pume', 81 'title': 'Pume Data', 82 'fields': 83 ('pume_score', 84 ) 85 }, 86 'StudentClearance': 87 {'id': 'clearance', 88 'title': 'Clearance Data', 89 'fields': 90 ('matric_no', 91 'entry_level', 92 'entry_session', 93 'nationality', 94 'lga', 95 ) 96 }, 97 'StudentPersonal': 98 {'id': 'personal', 99 'title': 'Personal Data', 100 'fields': 101 ('firstname', 102 'middlename', 103 'lastname', 104 'sex', 105 'email', 106 'phone', 107 ) 108 }, 109 'StudentStudyCourse': 110 {'id': 'study_course', 111 'title': 'Study Course', 112 'fields': 113 ('study_course', 114 'current_level', 115 'current_session', 116 'current_verdict', 117 ) 118 }, 119 } 120 ###) 121 65 122 def rwrite(self,s): 66 123 response = self.REQUEST.RESPONSE … … 199 256 password = self.generatePassword() 200 257 self.makeStudentMember(sid,password) 201 status,entry_mode = dict.get('entry_mode').split('_') 258 f2t = self.student_field2types 259 for pt in f2t.keys(): 260 student_obj.invokeFactory(pt,f2t[pt]['id']) 261 sub_obj = getattr(student_obj,f2t[pt]['id']) 262 sub_doc = sub_obj.getContent() 263 self.portal_workflow.doActionFor(sub_obj,'open',dest_container=sub_obj) 264 d = {'Title': f2t[pt]['title']} 265 for field in f2t[pt]['fields']: 266 d[field] = dict.get(field,None) 267 if pt == 'StudentPersonal': 268 d['sex'] = dict.get('sex') == 'F' 269 sub_doc.edit(mapping = d) 270 self.portal_workflow.doActionFor(sub_obj,'close',dest_container=sub_obj) 271 272 entry_session = dict.get('entry_session') 202 273 wfaction = 'return' 203 if status == "NEW":274 if entry_session == self.getSessionId(): 204 275 wfaction = 'admit' 205 matric_no = dict.get('matric_no')206 email = dict.get('email')207 level = dict.get('level')208 jamb_reg_no = dict.get('jamb_reg_no')209 study_course = dict.get('study_course')210 276 self.portal_workflow.doActionFor(student_obj,wfaction) 211 277 student_obj.manage_setLocalRoles(sid, ['Owner',]) 212 student_obj.invokeFactory('StudentApplication','application') 213 application = student_obj.application 214 self.portal_workflow.doActionFor(application,'open',dest_container=application) 215 da = {'Title': 'Application Data'} 216 student_obj.invokeFactory('StudentPersonal','personal') 217 da['entry_mode'] = entry_mode 218 personal = student_obj.personal 219 self.portal_workflow.doActionFor(personal,'open',dest_container=personal) 220 dp = {'Title': 'Personal Data'} 221 student_obj.invokeFactory('StudentClearance','clearance') 222 clearance = student_obj.clearance 223 self.portal_workflow.doActionFor(clearance,'open',dest_container=clearance) 224 dc = {'Title': 'Clearance/Eligibility Record'} 225 dc['matric_no'] = matric_no 226 da['app_email'] = dp['email'] = email 227 da['jamb_reg_no'] = jamb_reg_no 228 dp['firstname'] = dict.get('firstname') 229 dp['middlename'] = dict.get('middlename') 230 dp['lastname'] = dict.get('lastname') 231 da['jamb_lastname'] = "%(firstname)s %(middlename)s %(lastname)s" % dict 232 sex = dict.get('sex') 233 if sex: 234 da['jamb_sex'] = 'F' 235 else: 236 da['jamb_sex'] = 'M' 237 dp['sex'] = sex 238 application.getContent().edit(mapping=da) 239 self.portal_workflow.doActionFor(application,'close',dest_container=application) 240 personal.getContent().edit(mapping=dp) 241 clearance.getContent().edit(mapping=dc) 242 self.portal_workflow.doActionFor(clearance,'close',dest_container=clearance) 243 catd = {} 244 catd['id'] = sid 245 catd['entry_mode']= entry_mode 246 catd['email'] = email 247 catd['jamb_reg_no'] = jamb_reg_no 248 catd['matric_no'] = matric_no 249 catd['name'] = "%(firstname)s %(middlename)s %(lastname)s" % dp 250 catd['sex'] = dp['sex'] 251 catd['level'] = level 252 certificate_brain = self.getCertificateBrain(study_course) 253 if certificate_brain: 254 cpath = certificate_brain.getPath().split('/') 255 catd['faculty'] = cpath[-4] 256 catd['department'] = cpath[-3] 257 catd['course'] = study_course 258 self.students_catalog.addRecord(**catd) 259 # 260 # Study Course 261 # 262 student_obj.invokeFactory('StudentStudyCourse','study_course') 263 sc = student_obj.study_course 264 self.portal_workflow.doActionFor(sc,'open',dest_container=sc) 265 dsc = {} 266 dsc['study_course'] = study_course 267 dsc['current_level'] = level 268 sc.getContent().edit(mapping=dsc) 269 278 ## matric_no = dict.get('matric_no') 279 ## email = dict.get('email') 280 ## #level = dict.get('level') 281 ## jamb_reg_no = dict.get('jamb_reg_no') 282 ## study_course = dict.get('study_course') 283 ## self.portal_workflow.doActionFor(student_obj,wfaction) 284 ## student_obj.manage_setLocalRoles(sid, ['Owner',]) 285 ## student_obj.invokeFactory('StudentApplication','application') 286 ## application = student_obj.application 287 ## self.portal_workflow.doActionFor(application,'open',dest_container=application) 288 ## da = {'Title': 'Application Data'} 289 ## student_obj.invokeFactory('StudentPersonal','personal') 290 ## da['entry_mode'] = entry_mode 291 ## personal = student_obj.personal 292 ## self.portal_workflow.doActionFor(personal,'open',dest_container=personal) 293 ## dp = {'Title': 'Personal Data'} 294 ## student_obj.invokeFactory('StudentClearance','clearance') 295 ## clearance = student_obj.clearance 296 ## self.portal_workflow.doActionFor(clearance,'open',dest_container=clearance) 297 ## dc = {'Title': 'Clearance/Eligibility Record'} 298 ## dc['matric_no'] = matric_no 299 ## da['app_email'] = dp['email'] = email 300 ## da['jamb_reg_no'] = jamb_reg_no 301 ## dp['firstname'] = dict.get('firstname') 302 ## dp['middlename'] = dict.get('middlename') 303 ## dp['lastname'] = dict.get('lastname') 304 ## da['jamb_lastname'] = "%(firstname)s %(middlename)s %(lastname)s" % dict 305 ## sex = dict.get('sex') 306 ## if sex: 307 ## da['jamb_sex'] = 'F' 308 ## else: 309 ## da['jamb_sex'] = 'M' 310 ## dp['sex'] = sex 311 ## application.getContent().edit(mapping=da) 312 ## self.portal_workflow.doActionFor(application,'close',dest_container=application) 313 ## personal.getContent().edit(mapping=dp) 314 ## clearance.getContent().edit(mapping=dc) 315 ## self.portal_workflow.doActionFor(clearance,'close',dest_container=clearance) 316 #### catd = {} 317 #### catd['id'] = sid 318 #### catd['entry_mode']= entry_mode 319 #### catd['email'] = email 320 #### catd['jamb_reg_no'] = jamb_reg_no 321 #### catd['matric_no'] = matric_no 322 #### catd['name'] = "%(firstname)s %(middlename)s %(lastname)s" % dp 323 #### catd['sex'] = dp['sex'] 324 #### catd['level'] = level 325 #### certificate_brain = self.getCertificateBrain(study_course) 326 #### if certificate_brain: 327 #### cpath = certificate_brain.getPath().split('/') 328 #### catd['faculty'] = cpath[-4] 329 #### catd['department'] = cpath[-3] 330 #### catd['course'] = study_course 331 #### self.students_catalog.addRecord(**catd) 332 ## # 333 ## # Study Course 334 ## # 335 ## student_obj.invokeFactory('StudentStudyCourse','study_course') 336 ## sc = student_obj.study_course 337 ## self.portal_workflow.doActionFor(sc,'open',dest_container=sc) 338 ## dsc = {} 339 ## dsc['study_course'] = study_course 340 ## #dsc['current_level'] = level 341 ## sc.getContent().edit(mapping=dsc) 342 ## 270 343 return sid,password 271 344 ###)
Note: See TracChangeset for help on using the changeset viewer.