Changeset 396
- Timestamp:
- 20 Aug 2006, 15:39:15 (18 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Students.py
r395 r396 57 57 logger.info('processing "%(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) 58 58 sid = student.get('MatricNo') 59 if sid == "": 60 em = 'Empty MatricNo\n' 61 logger.info(em) 62 no_import.write(em) 63 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) 64 continue 59 65 certcode = makeCertificateCode(student.get('CourseMajor')) 60 66 if sid in students_added: … … 150 156 ###) 151 157 158 security.declareProtected(ModifyPortalContent,"loadFullTimeStudentsResultsFromCSV") 159 def loadFullTimeStudentsResultsFromCSV(self): 160 """load Fulltime Studentdata from CSV values""" 161 #return 162 name = 'short_full_time_results_2004_2005.csv' 163 no_import = False 164 if not no_import: 165 no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w") 166 no_import.write('"Matnumber","CosCode","Ansbook","CosStuatus","Session","Mat_Cos","Score","CarryLevel","Grade","Weight","Semster","Verdict","Level","id","GPA"\n') 167 logger = logging.getLogger('%s_import' % name) 168 logger.info('Start loading from %s.csv' % name) 169 students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject() 170 try: 171 results = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) 172 except: 173 logger.error('Error reading %s.csv' % name) 174 return 175 l = self.portal_catalog({'meta_type': "Student"}) 176 students = {} 177 for s in l: 178 students[s.id] = s.getObject() 179 courses = self.portal_catalog({'meta_type': "Course"}) 180 for result in results: 181 sid = result.get('Matnumber') 182 if sid not in students.keys(): 183 em = 'Student with ID %(Matnumber)s not found\n' % student 184 logger.info(em) 185 no_import.write(em) 186 no_import.write('"%(Matnumber)s","%(CosCode)s","%(Ansbook)s","%(CosStuatus)s","%(Session)s","%(Mat_Cos)s","%(Score)s","%(CarryLevel)s","%(Grade)s","%(Weight)s","%(Semster)s","%(Verdict)s","%(Level)s","%(id)s","%(GPA)s"\n' % student) 187 continue 188 if student.get('CosCode') not in courses: 189 em = 'Course with ID %(CosCode)s not found\n' % student 190 logger.info(em) 191 no_import.write(em) 192 no_import.write('"%(Matnumber)s","%(CosCode)s","%(Ansbook)s","%(CosStuatus)s","%(Session)s","%(Mat_Cos)s","%(Score)s","%(CarryLevel)s","%(Grade)s","%(Weight)s","%(Semster)s","%(Verdict)s","%(Level)s","%(id)s","%(GPA)s"\n' % student) 193 continue 194 level = student.get('Level') 195 try: 196 int(level) 197 except: 198 em = 'Result for Student with ID %(Matnumber)s Course %(CosCode)s Level is empty\n' % student 199 logger.info(em) 200 no_import.write(em) 201 no_import.write('"%(Matnumber)s","%(CosCode)s","%(Ansbook)s","%(CosStuatus)s","%(Session)s","%(Mat_Cos)s","%(Score)s","%(CarryLevel)s","%(Grade)s","%(Weight)s","%(Semster)s","%(Verdict)s","%(Level)s","%(id)s","%(GPA)s"\n' % student) 202 continue 203 sf = students.get(sid) 204 sc = getattr(sf,'study_course') 205 l = getattr(sc,level,None) 206 if l is None: 207 #self.log('Creating Department %(DeptCode)s = %(Description)s' % dep) 208 logger.info('Creating Level %(StudentLevel)s for %(fullname)s' % student) 209 sc.invokeFactory('StudyLevel', level) 210 l = getattr(sc, level) 211 l.getContent().edit(mapping={'Title': "Level %s" % level}) 212 l.invokeFactory('Semester','first') 213 l.invokeFactory('Semester','second') 214 first_s = getattr(l,'first') 215 first_s.getContent().edit(mapping={'Title': 'First Semester'}) 216 second_s = getattr(l,'second') 217 second_s.getContent().edit(mapping={'Title': 'Second Semester'}) 218 snr = student.get('Semester') 219 semester = getattr(l,'first') 220 if snr == "1": 221 semester = getattr(l,'second') 222 223 224 225 152 226 security.declareProtected(View,"Title") 153 227 def Title(self): -
WAeUP_SRP/trunk/profiles/default/types/CourseTicket.xml
r319 r396 33 33 <property name="storage_methods"/> 34 34 <property name="cps_is_portlet">False</property> 35 <alias from="(Default)" to=" temporary_view_all"/>36 <alias from="view" to=" temporary_view_all"/>35 <alias from="(Default)" to="academics_contents"/> 36 <alias from="view" to="academics_contents"/> 37 37 <action title="Standard View" action_id="view" category="object" 38 condition_expr="" url_expr="string:${object_url}/ temporary_view_all"38 condition_expr="" url_expr="string:${object_url}/academics_contents" 39 39 visible="True"> 40 40 <permission value="View"/> … … 42 42 <action title="action_metadata" action_id="metadata" category="object" 43 43 condition_expr="python:member and 'Manager' in member.getRoles()" 44 url_expr="string:${object_url}/cpsdocument_metadata" visible="True"> 45 <permission value="University Manage"/> 46 </action> 44 url_expr="string:${object_url}/cpsdocument_metadata" visible="True"/> 47 45 <action title="Delegate" action_id="localroles" category="object" 48 46 condition_expr="" url_expr="string:${object_url}/folder_localrole_form" 49 visible="False"> 50 <permission value="University Manage"/> 51 </action> 47 visible="False"/> 52 48 </object> -
WAeUP_SRP/trunk/profiles/default/types/StudentStudyCourse.xml
r370 r396 33 33 <property name="storage_methods"/> 34 34 <property name="cps_is_portlet">False</property> 35 <alias from="(Default)" to=" cpsdocument_view"/>36 <alias from="view" to=" cpsdocument_view"/>35 <alias from="(Default)" to="academics_contents"/> 36 <alias from="view" to="academics_contents"/> 37 37 <action title="View" action_id="view" category="object" condition_expr="" 38 url_expr="string:${object_url}/ cpsdocument_view" visible="True">38 url_expr="string:${object_url}/academics_contents" visible="True"> 39 39 <permission value="View"/> 40 40 </action>
Note: See TracChangeset for help on using the changeset viewer.