Changeset 422
- Timestamp:
- 25 Aug 2006, 16:21:44 (18 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Students.py
r398 r422 20 20 i_home = Globals.INSTANCE_HOME 21 21 MAX_TRANS = 1000 22 23 def generateStudentId(): 24 import random 25 r = random.random() 26 return "%c%d" % (r.choice('ABCDEFGIJHKLMNOPQRSTUVWXYZ'),r.randint(99999,1000000)) 27 28 22 29 23 30 class StudentsFolder(CPSDocument): ###( … … 48 55 logger.error('Error reading %s.csv' % name) 49 56 return 50 l = self.portal_catalog({'meta_type': "Student "})51 studs = {}57 l = self.portal_catalog({'meta_type': "StudentClearance",}) 58 matrics = [] 52 59 for s in l: 53 studs[s.id] = s.getObject()60 matrics.append(s.getObject().getContent().matric_no) 54 61 l = self.portal_catalog({'meta_type': "Certificate"}) 55 62 certs = {} 56 students_added = []57 63 for c in l: 58 64 certs[c.id] = c.getObject() … … 67 73 continue 68 74 certcode = makeCertificateCode(student.get('CourseMajor')) 69 ## if sid in students_added:70 ## em = 'Student with ID %(MatricNo)s %(fullname)s already exists in this import\n' % student71 ## logger.info(em)72 ## no_import.write(em)73 ## no_import.write('"%(MatricNo)s","%(EntryRegNo)s","%(CurrentSession)s","%(StudentLevel)s","%(fullname)s","%(FirstName)s","%(MiddleName)s","%(Lastname)s","%(FormerSurname)s","%(Sex)s","%(Nationality)s","%(State)s","%(LGA)s","%(PermanentAddress)s","%(PermanentAddressCity)s","%(CampusAddress)s","%(PhoneNumber)s","%(Emailaddress)s","%(Mode)s","%(CourseMajor)s","%(Faculty)s","%(Dept)s"\n' % student)74 ## continue75 s = studs.get(sid,None)76 75 if certcode not in certs.keys(): 77 76 em = 'Certificate with ID %s %s not found\n' % (certcode, student.get('CourseMajor')) … … 89 88 no_import.write('"%(MatricNo)s","%(EntryRegNo)s","%(CurrentSession)s","%(StudentLevel)s","%(fullname)s","%(FirstName)s","%(MiddleName)s","%(Lastname)s","%(FormerSurname)s","%(Sex)s","%(Nationality)s","%(State)s","%(LGA)s","%(PermanentAddress)s","%(PermanentAddressCity)s","%(CampusAddress)s","%(PhoneNumber)s","%(Emailaddress)s","%(Mode)s","%(CourseMajor)s","%(Faculty)s","%(Dept)s"\n' % student) 90 89 continue 91 if s is None: 90 matric_no = student.get('MatricNo') 91 if matric_no not in matrics: 92 matrics.append(matric_no) 93 sid = generateStudentId() 92 94 #self.log('Creating Faculty %(id)s = %(Title)s' % faculty) 93 logger.info('Creating Student with ID %( MatricNo)s %(fullname)s' % student)95 logger.info('Creating Student with ID %(sid)s Matric_no %(matric_no)s ' % vars()) 94 96 students_folder.invokeFactory('Student', sid) 95 97 s = getattr(self,sid) 96 students_added.append(sid)97 studs[sid] = s98 98 s.invokeFactory('StudentPersonal','personal') 99 99 sp = s.personal 100 100 d = {'Title': 'Personal Data'} 101 d['matricel_no'] = student.get('MatricNo') 102 d['entry_reg_no'] = student.get('EntryRegNo') 103 d['fullname'] = student.get('fullname') 101 s.invokeFactory('StudentClearance','clearance') 102 sc = s.personal 103 dc = {'Title': 'Clearance Data'} 104 dc['matric_no'] = matric_no 105 dc['jamb_reg_no'] = student.get('EntryRegNo') 106 dc['lga'] = student.get('LGA') 107 dc['nationality'] = student.get('Nationality') 108 dc['email'] = student.get('Emailaddress') 104 109 d['firstname'] = student.get('FirstName') 105 110 d['middlename'] = student.get('MiddleName') … … 107 112 d['former_surname'] = student.get('FormerSurname') 108 113 d['sex'] = student.get('Sex') == 'F' 109 d['nationality'] = student.get('Nationality') 110 d['state'] = student.get('State') 111 d['lga'] = student.get('LGA') 112 d['street'] = student.get('PermanentAddress') 113 d['city'] = student.get('PermanentAddressCity') 114 d['for_state'] = student.get('State') 115 d['for_lga'] = student.get('LGA') 116 d['perm_address'] = student.get('PermanentAddress') 117 d['perm_city'] = student.get('PermanentAddressCity') 114 118 d['campus_address'] = student.get('CampusAddress') 115 119 d['phone'] = student.get('PhoneNumber') 116 d['email'] = student.get('Emailaddress')117 120 sp.getContent().edit(mapping=d) 121 sc.getContent().edit(mapping=dc) 118 122 # 119 123 # Study Course … … 122 126 sc = s.study_course 123 127 d = {} 124 d['matricel_no'] = student.get('MatricNo')125 d['entry_reg_no'] = student.get('EntryRegNo')126 d['faculty'] = student.get('Faculty')127 d['department'] = student.get('Dept')128 #d['matricel_no'] = student.get('MatricNo') 129 #d['entry_reg_no'] = student.get('EntryRegNo') 130 #d['faculty'] = student.get('Faculty') 131 #d['department'] = student.get('Dept') 128 132 d['course_major'] = certcode 129 133 css = student.get('CurrentSession') or '2004-2005' … … 158 162 no_import.write('"%(MatricNo)s","%(EntryRegNo)s","%(CurrentSession)s","%(StudentLevel)s","%(fullname)s","%(FirstName)s","%(MiddleName)s","%(Lastname)s","%(FormerSurname)s","%(Sex)s","%(Nationality)s","%(State)s","%(LGA)s","%(PermanentAddress)s","%(PermanentAddressCity)s","%(CampusAddress)s","%(PhoneNumber)s","%(Emailaddress)s","%(Mode)s","%(CourseMajor)s","%(Faculty)s","%(Dept)s"\n' % student) 159 163 if tr_count > MAX_TRANS: 160 #transaction.commit()161 #em = '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Transaction commited\n' % student164 transaction.commit() 165 em = 'Transaction commited\n' % student 162 166 logger.info(em) 163 167 tr_count = 0 -
WAeUP_SRP/trunk/Widgets.py
r388 r422 151 151 152 152 valid = CPSStringWidget.validate(self, datastructure, **kw) 153 id_pat_str = r"\S" 154 inv_id_pat = compile(r"^%s$" % id_pat_str) 153 155 if not valid: 154 156 return 0 … … 157 159 value = datastructure[widget_id].upper() 158 160 err = 0 159 if hasattr(self.aq_parent,value): 161 if value.split() > 1: 162 err = 'Invalid Id (Id contains space(s)' 163 elif hasattr(self.aq_parent,value): 160 164 err = 'An object with the Id %s already exists in this context' % (value) 161 165 if err: -
WAeUP_SRP/trunk/profiles/default/layouts/department.xml
r389 r422 33 33 <element value="code"/> 34 34 </property> 35 <property name="is_required">True</property> 35 36 <property name="label">Object ID</property> 36 37 <property name="label_edit">Object ID</property> -
WAeUP_SRP/trunk/profiles/default/workflows.xml
r384 r422 57 57 <bound-workflow workflow_id="section_folder_wf"/> 58 58 </type> 59 <type type_id="Jamb">60 <bound-workflow workflow_id="waeup_base_wf"/>61 </type>62 <type type_id="Members Workspace">63 <bound-workflow workflow_id="workspace_folder_wf"/>64 </type>65 <type type_id="Section">66 <bound-workflow workflow_id="section_folder_wf"/>67 </type>68 59 <type type_id="Semester"> 69 60 <bound-workflow workflow_id="section_folder_wf"/> … … 75 66 <bound-workflow workflow_id="waeup_base_wf"/> 76 67 </type> 77 <type type_id="Student Elegibility">78 <bound-workflow workflow_id=" waeup_base_wf"/>68 <type type_id="StudentClearance"> 69 <bound-workflow workflow_id="section_folder_wf"/> 79 70 </type> 80 <type type_id="Student Eligibility">81 <bound-workflow workflow_id=" waeup_base_wf"/>71 <type type_id="StudentAdmission"> 72 <bound-workflow workflow_id="section_folder_wf"/> 82 73 </type> 83 74 <type type_id="StudentPersonal">
Note: See TracChangeset for help on using the changeset viewer.