1 | #-*- mode: python; mode: fold -*- |
---|
2 | # $Id: Students.py 1902 2007-06-15 16:48:48Z joachim $ |
---|
3 | from string import Template |
---|
4 | from Globals import InitializeClass |
---|
5 | from AccessControl import ClassSecurityInfo |
---|
6 | from AccessControl.SecurityManagement import newSecurityManager |
---|
7 | from zExceptions import BadRequest |
---|
8 | from Products.ZCatalog.ZCatalog import ZCatalog |
---|
9 | from Products.CMFCore.utils import UniqueObject, getToolByName |
---|
10 | from Products.CMFCore.permissions import View |
---|
11 | from Products.CMFCore.permissions import ModifyPortalContent |
---|
12 | from Products.CPSCore.CPSBase import CPSBase_adder, CPSBaseFolder |
---|
13 | #from Products.CPSCore.CPSBase import CPSBaseDocument as BaseDocument |
---|
14 | from Products.CPSDocument.CPSDocument import CPSDocument |
---|
15 | from Products.CPSCore.CPSBase import CPSBaseBTreeFolder as BaseBTreeFolder |
---|
16 | from Products.CPSCore.CPSMembershipTool import CPSUnrestrictedUser |
---|
17 | from Products.WAeUP_SRP.Academics import makeCertificateCode |
---|
18 | from Products.AdvancedQuery import Eq, Between, Le,In |
---|
19 | import DateTime |
---|
20 | import logging |
---|
21 | import csv,re,os |
---|
22 | import Globals |
---|
23 | p_home = Globals.package_home(globals()) |
---|
24 | i_home = Globals.INSTANCE_HOME |
---|
25 | MAX_TRANS = 1000 |
---|
26 | from urllib import urlencode |
---|
27 | |
---|
28 | import DateTime |
---|
29 | #import PIL.Image |
---|
30 | from StringIO import StringIO |
---|
31 | |
---|
32 | def makeCertificateCode(code): ###( |
---|
33 | code = code.replace('.','') |
---|
34 | code = code.replace('(','') |
---|
35 | code = code.replace(')','') |
---|
36 | code = code.replace('/','') |
---|
37 | code = code.replace(' ','') |
---|
38 | code = code.replace('_','') |
---|
39 | return code |
---|
40 | |
---|
41 | ###) |
---|
42 | |
---|
43 | def response_write(response,s): |
---|
44 | response.setHeader('Content-type','text/html; charset=ISO-8859-15') |
---|
45 | while s.find('<') > -1: |
---|
46 | s = s.replace('<','<') |
---|
47 | while s.find('>') > -1: |
---|
48 | #from pdb import set_trace;set_trace() |
---|
49 | s = s.replace('>','>') |
---|
50 | response.write("%s<br>\n" % s) |
---|
51 | |
---|
52 | def getInt(s): ###( |
---|
53 | try: |
---|
54 | return int(s) |
---|
55 | except: |
---|
56 | return 0 |
---|
57 | |
---|
58 | def getFloat(s): |
---|
59 | try: |
---|
60 | return float(s) |
---|
61 | except: |
---|
62 | return 0.0 |
---|
63 | |
---|
64 | ###) |
---|
65 | |
---|
66 | def getStudentByRegNo(self,reg_no): ###( |
---|
67 | """search student by JAMB Reg No and return StudentFolder""" |
---|
68 | res = self.students_catalog(jamb_reg_no = reg_no) |
---|
69 | if len(res) == 1: |
---|
70 | return getattr(self.portal_url.getPortalObject().campus.students,res[0].id) |
---|
71 | else: |
---|
72 | return None |
---|
73 | # don't search in portal_catalog |
---|
74 | # search = ZCatalog.searchResults(self.portal_catalog_real,{'meta_type': 'StudentApplication', |
---|
75 | # 'SearchableText': reg_no, |
---|
76 | # }) |
---|
77 | # if len(search) < 1: |
---|
78 | # return None |
---|
79 | # return search[0].getObject().aq_parent |
---|
80 | |
---|
81 | ###) |
---|
82 | |
---|
83 | def checkJambNo(jnr): |
---|
84 | try: |
---|
85 | if len(jnr) != 10: |
---|
86 | return False |
---|
87 | except: |
---|
88 | return False |
---|
89 | try: |
---|
90 | int(jnr[:8]) |
---|
91 | return True |
---|
92 | except: |
---|
93 | return False |
---|
94 | |
---|
95 | class StudentsFolder(CPSDocument): ###( |
---|
96 | """ |
---|
97 | WAeUP container for the various WAeUP containers data |
---|
98 | """ |
---|
99 | meta_type = 'StudentsFolder' |
---|
100 | portal_type = meta_type |
---|
101 | security = ClassSecurityInfo() |
---|
102 | |
---|
103 | security.declareProtected(ModifyPortalContent,"loadPumeResultsFromCSV")###( |
---|
104 | def loadPumeResultsFromCSV(self): |
---|
105 | """load Fulltime Studentdata from CSV values into pumeresults catalog""" |
---|
106 | import transaction |
---|
107 | import random |
---|
108 | ## csv_d = {'jamb_reg_no': "RegNumber", ###( |
---|
109 | ## 'status': "Admission Status", |
---|
110 | ## 'name': "Name", |
---|
111 | ## 'score': "Score", |
---|
112 | ## 'sex': "Sex", |
---|
113 | ## 'faculty': "Faculty", |
---|
114 | ## 'department': "Dept", |
---|
115 | ## 'course': "Course", |
---|
116 | ## 'course_code_org': "Course Code", |
---|
117 | ## } |
---|
118 | ###) |
---|
119 | ## csv_d = {'jamb_reg_no': "JAMBRegno", |
---|
120 | ## 'name': "Name", |
---|
121 | ## 'score': "Score", |
---|
122 | ## 'sex': "Sex", |
---|
123 | ## 'course': "Course", |
---|
124 | ## 'faculty': "Faculty", |
---|
125 | ## 'department': "Dept", |
---|
126 | ## 'course_code_org': "Course Code", |
---|
127 | ## 'status': "Admission Status", |
---|
128 | ## 'result_type': None, |
---|
129 | ## } |
---|
130 | |
---|
131 | csv_d = {'jamb_reg_no': "reg_no", |
---|
132 | 'name': "fullname", |
---|
133 | 'score': "pume_score", |
---|
134 | 'sex': "sex", |
---|
135 | 'course': "study_course", |
---|
136 | 'course_code_org': "study_course", |
---|
137 | 'status': "admission_status", |
---|
138 | 'result_type': "entry_mode", |
---|
139 | } |
---|
140 | |
---|
141 | csv_fields = [f[1] for f in csv_d.items() if f[1]] |
---|
142 | tr_count = 0 |
---|
143 | total = 0 |
---|
144 | #name = 'pup_new' |
---|
145 | #name = 'pup_update' |
---|
146 | name = 'Admitted_update' |
---|
147 | update = name.endswith('update') |
---|
148 | no_import = [] |
---|
149 | ok_import = [] |
---|
150 | ok_import.append('%s' % ','.join(['"%s"' % fn for fn in csv_d.keys()])) |
---|
151 | no_import.append('%s' % ','.join(['"%s"' % fn for fn in csv_fields])) |
---|
152 | current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") |
---|
153 | ok_import_name = "%s/import/%s_imported_%s.csv" % (i_home,name,current) |
---|
154 | #open(ok_import_name,"w").write('\n'.join(no_import)) |
---|
155 | no_import_name = "%s/import/%s_not_imported_%s.csv" % (i_home,name,current) |
---|
156 | #open(no_import_name,"w").write('\n'.join(no_import)) |
---|
157 | logger = logging.getLogger('Students.loadPumeResultsFromCSV') |
---|
158 | starttime = DateTime.now() |
---|
159 | logger.info('Start loading from %s.csv' % name) |
---|
160 | try: |
---|
161 | result = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) |
---|
162 | except: |
---|
163 | logger.error('Error reading %s.csv' % name) |
---|
164 | return |
---|
165 | pume = self.portal_pumeresults |
---|
166 | format = ','.join(['"%%(%s)s"' % fn for fn in csv_fields]) |
---|
167 | import_format = ','.join(['"%%(%s)s"' % fn for fn in csv_d.keys()]) |
---|
168 | eduplicate = '%s,"duplicate"' % format |
---|
169 | eoriginal = '%s,"original"' % format |
---|
170 | einvalidjamb = '%s,"invalid JambRegNo"' % format |
---|
171 | added = 'added ,%s' % format |
---|
172 | #from pdb import set_trace;set_trace() |
---|
173 | for jamb in result: |
---|
174 | dict = {} |
---|
175 | for f,fn in csv_d.items(): |
---|
176 | dict[f] = jamb.get(csv_d[f]) |
---|
177 | dict['result_type'] = 'CEST' |
---|
178 | jnr = jamb.get(csv_d['jamb_reg_no']) |
---|
179 | #if not checkJambNo(jnr): |
---|
180 | # logger.info(einvalidjamb % jamb) |
---|
181 | # dd = {} |
---|
182 | # for f,fn in csv_d.items(): |
---|
183 | # dd[fn] = getattr(data,f) |
---|
184 | # no_import.append(eduplicate % dd) |
---|
185 | # no_import.append(eduplicate % jamb) |
---|
186 | # continue |
---|
187 | res = pume(jamb_reg_no=jnr) |
---|
188 | if len(res) > 0: |
---|
189 | if update: |
---|
190 | try: |
---|
191 | pume.modifyRecord(**dict) |
---|
192 | # Can not happen, but anyway... |
---|
193 | except ValueError: |
---|
194 | logger.info(eduplicate % jamb) |
---|
195 | continue |
---|
196 | # Can not happen, but anyway... |
---|
197 | except KeyError: |
---|
198 | pume.addRecord(**dict) |
---|
199 | logger.info(added % jamb) |
---|
200 | continue |
---|
201 | else: |
---|
202 | data = res[0] |
---|
203 | if data.name != jamb.get(csv_d['name']): |
---|
204 | #set_trace() |
---|
205 | logger.info(eduplicate % jamb) |
---|
206 | #em = 'Student with REG-NO %(jamb_reg_no)s already exists\n' % dict |
---|
207 | #logger.info(em) |
---|
208 | dd = {} |
---|
209 | for f,fn in csv_d.items(): |
---|
210 | dd[fn] = getattr(data,f) |
---|
211 | no_import.append(eoriginal % dd) |
---|
212 | no_import.append(eduplicate % jamb) |
---|
213 | continue |
---|
214 | else: |
---|
215 | try: |
---|
216 | pume.addRecord(**dict) |
---|
217 | ok_import.append(import_format % dict) |
---|
218 | except ValueError: |
---|
219 | logger.info(eduplicate % jamb) |
---|
220 | #em = 'Student with REG-NO %(jamb_reg_no)s already exists\n' % dict |
---|
221 | #logger.info(em) |
---|
222 | no_import.append(eduplicate % jamb) |
---|
223 | logger.info('End loading from %s.csv' % name) |
---|
224 | if len(no_import) > 1: |
---|
225 | open(no_import_name,"w+").write('\n'.join(no_import)) |
---|
226 | open(ok_import_name,"w+").write('\n'.join(ok_import)) |
---|
227 | return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) |
---|
228 | ###) |
---|
229 | |
---|
230 | security.declareProtected(ModifyPortalContent,"createStudents")###( |
---|
231 | def createStudents(self): |
---|
232 | """ |
---|
233 | load addmitted Studentdata from CSV values and create Studentobjects. |
---|
234 | This is the current method to create new addmitted Students. |
---|
235 | Before running the eventservice for the students_catalog must be disabled. |
---|
236 | """ |
---|
237 | import transaction |
---|
238 | import random |
---|
239 | #from pdb import set_trace |
---|
240 | wftool = self.portal_workflow |
---|
241 | #students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject() |
---|
242 | students_folder = self.portal_url.getPortalObject().campus.students |
---|
243 | levels = {'ume_ft':'100', |
---|
244 | 'de_ft': '200', |
---|
245 | 'ug_pt': '100', |
---|
246 | 'de_pt': '200', |
---|
247 | 'pg_ft': '700', |
---|
248 | 'pg_pt': '700', |
---|
249 | 'dp_pt': '100', |
---|
250 | 'dp_ft': '100', |
---|
251 | } |
---|
252 | csv_d = {'jamb_reg_no': "reg_no", |
---|
253 | 'entry_mode': 'entry_mode', |
---|
254 | 'jamb_firstname': "firstname", |
---|
255 | 'jamb_middlename': "middlename", |
---|
256 | 'jamb_lastname': "lastname", |
---|
257 | 'jamb_sex': "sex", |
---|
258 | 'jamb_state': "state", |
---|
259 | 'birthday': "date_of_birth", |
---|
260 | 'app_email': "email", |
---|
261 | 'study_course': "study_course", |
---|
262 | 'perm_address': "address", |
---|
263 | 'admission_status': "admission_status", |
---|
264 | } |
---|
265 | csv_fields = [f[1] for f in csv_d.items()] |
---|
266 | tr_count = 0 |
---|
267 | total = 0 |
---|
268 | #name = 'pume_results' |
---|
269 | name = 'Admitted' |
---|
270 | no_import = [] |
---|
271 | s = ','.join(['"%s"' % fn for fn in csv_fields]) |
---|
272 | no_import.append('"Error",%s' % s) |
---|
273 | format = '"%(Error)s",' + ','.join(['"%%(%s)s"' % fn for fn in csv_fields]) |
---|
274 | no_certificate = "no certificate %s" % format |
---|
275 | open("%s/import/%s_not_imported.csv" % (i_home,name),"w").write('\n'.join(no_import)) |
---|
276 | logger = logging.getLogger('Students.StudentsFolder.createStudents') |
---|
277 | logger.info('Start loading from %s.csv' % name) |
---|
278 | certs = {} |
---|
279 | try: |
---|
280 | results = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) |
---|
281 | except: |
---|
282 | logger.error('Error reading %s.csv' % name) |
---|
283 | return |
---|
284 | for result in results: |
---|
285 | if not result.get(csv_d['admission_status']).startswith('Admitted'): |
---|
286 | continue |
---|
287 | #result['Error'] = "Processing " |
---|
288 | #logger.info(format % result) |
---|
289 | jamb_reg_no = result.get(csv_d['jamb_reg_no']) |
---|
290 | res = self.students_catalog(jamb_reg_no = jamb_reg_no) |
---|
291 | if res: |
---|
292 | em = 'Student with RegNo %s already exists\n' % jamb_reg_no |
---|
293 | logger.info(em) |
---|
294 | result['Error'] = "Student exists" |
---|
295 | no_import.append(format % result) |
---|
296 | continue |
---|
297 | cert_id = makeCertificateCode(result.get(csv_d['study_course'])) |
---|
298 | if cert_id not in certs.keys(): |
---|
299 | res = self.portal_catalog(meta_type = "Certificate",id = cert_id) |
---|
300 | if not res: |
---|
301 | em = 'No Certificate with ID %s \n' % cert_id |
---|
302 | logger.info(em) |
---|
303 | result['Error'] = "No Certificate %s" % cert_id |
---|
304 | no_import.append( format % result) |
---|
305 | continue |
---|
306 | cert = res[0] |
---|
307 | cert_path = cert.getPath().split('/') |
---|
308 | certificate = certs[cert_id] = {'faculty': cert_path[-4], |
---|
309 | 'department': cert_path[-3]} |
---|
310 | cert_doc = certs[cert_id] |
---|
311 | catalog_entry = {} |
---|
312 | catalog_entry['jamb_reg_no'] = jamb_reg_no |
---|
313 | firstname = result.get(csv_d['jamb_firstname']) |
---|
314 | middlename = result.get(csv_d['jamb_middlename']) |
---|
315 | lastname = result.get(csv_d['jamb_lastname']) |
---|
316 | if len(firstname) < 3\ |
---|
317 | and len(middlename) < 3\ |
---|
318 | and len(lastname) < 3: |
---|
319 | em = 'Student Names to short \n' |
---|
320 | logger.info(em) |
---|
321 | result['Error'] = "Names to short" |
---|
322 | no_import.append( format % result) |
---|
323 | continue |
---|
324 | perm_address = result.get(csv_d['perm_address']) |
---|
325 | sid = self.generateStudentId('x') |
---|
326 | students_folder.invokeFactory('Student', sid) |
---|
327 | catalog_entry['id'] = sid |
---|
328 | tr_count += 1 |
---|
329 | logger.info('%(total)s+%(tr_count)s: Creating Student with ID %(sid)s reg_no %(jamb_reg_no)s ' % vars()) |
---|
330 | student = getattr(self,sid) |
---|
331 | student.manage_setLocalRoles(sid, ['Owner',]) |
---|
332 | student.invokeFactory('StudentApplication','application') |
---|
333 | da = {'Title': 'Application Data'} |
---|
334 | da["jamb_firstname"] = firstname |
---|
335 | da["jamb_middlename"] = middlename |
---|
336 | da["jamb_lastname"] = lastname |
---|
337 | catalog_entry['entry_session'] = da["entry_session"] = self.getSessionId()[-2:] |
---|
338 | catalog_entry['sex'] = sex = result.get(csv_d['jamb_sex']).startswith('F') |
---|
339 | da_fields = ('jamb_reg_no', |
---|
340 | 'jamb_sex', |
---|
341 | 'jamb_state', |
---|
342 | 'entry_mode', |
---|
343 | 'app_email', |
---|
344 | ) |
---|
345 | for f in da_fields: |
---|
346 | da[f] = result.get(csv_d[f]) |
---|
347 | catalog_entry['email'] = da['app_email'] |
---|
348 | catalog_entry['entry_mode'] = da['entry_mode'] |
---|
349 | app = student.application |
---|
350 | app_doc = app.getContent() |
---|
351 | app.getContent().edit(mapping=da) |
---|
352 | picture ="%s/import/pictures/%s.jpg" % (i_home,jamb_reg_no) |
---|
353 | app.manage_setLocalRoles(sid, ['Owner',]) |
---|
354 | |
---|
355 | picture_id = da['jamb_reg_no'].replace('/','_') |
---|
356 | file = None |
---|
357 | for ext in ('jpg','JPG'): |
---|
358 | picture ="%s/import/pictures_admitted_latest/%s.%s" % (i_home,picture_id,ext) |
---|
359 | if os.path.exists(picture): |
---|
360 | file = open(picture) |
---|
361 | break |
---|
362 | if file is not None: |
---|
363 | |
---|
364 | ## file conversion does not work |
---|
365 | #img = PIL.Image.open(file) |
---|
366 | #img.thumbnail((150,200), |
---|
367 | # resample=PIL.Image.ANTIALIAS) |
---|
368 | #outfile = StringIO() |
---|
369 | #img.save(outfile, format=img.format) |
---|
370 | |
---|
371 | outfile = file.read() |
---|
372 | app_doc.manage_addFile('passport', |
---|
373 | file=outfile, |
---|
374 | title="%s.jpg" % jamb_reg_no) |
---|
375 | #wftool.doActionFor(app,'close') |
---|
376 | dp = {} |
---|
377 | dp['firstname'] = firstname |
---|
378 | dp['middlename'] = middlename |
---|
379 | dp['lastname'] = lastname |
---|
380 | dp['email'] = da['app_email'] |
---|
381 | dp['sex'] = sex |
---|
382 | dp['perm_address'] = perm_address |
---|
383 | catalog_entry['name'] = "%(firstname)s %(middlename)s %(lastname)s" % dp |
---|
384 | student.invokeFactory('StudentPersonal','personal') |
---|
385 | per = student.personal |
---|
386 | per_doc = per.getContent() |
---|
387 | per_doc.edit(mapping = dp) |
---|
388 | per.manage_setLocalRoles(sid, ['Owner',]) |
---|
389 | wftool.doActionFor(student,'pume_pass') |
---|
390 | wftool.doActionFor(student,'admit') |
---|
391 | # |
---|
392 | # Clearance |
---|
393 | # |
---|
394 | student.invokeFactory('StudentClearance','clearance') |
---|
395 | #wftool.doActionFor(student.clearance,'open') |
---|
396 | clearance = student.clearance |
---|
397 | dc = {'Title': 'Clearance/Eligibility Record'} |
---|
398 | clearance = student.clearance |
---|
399 | date_str = result.get(csv_d['birthday']) |
---|
400 | try: |
---|
401 | date = DateTime.DateTime(date_str) |
---|
402 | except: |
---|
403 | #import pdb;pdb.set_trace() |
---|
404 | date = None |
---|
405 | dc['birthday'] = date |
---|
406 | clearance.getContent().edit(mapping=dc) |
---|
407 | clearance.manage_setLocalRoles(sid, ['Owner',]) |
---|
408 | # |
---|
409 | # Study Course |
---|
410 | # |
---|
411 | student.invokeFactory('StudentStudyCourse','study_course') |
---|
412 | study_course = student.study_course |
---|
413 | dsc = {} |
---|
414 | catalog_entry['level'] = dsc['current_level'] = levels.get(da['entry_mode'],'100') |
---|
415 | #catalog_entry['level'] = dsc['current_level'] = '100' # Attention: not for DE students |
---|
416 | catalog_entry['session'] = dsc['current_session'] = da['entry_session'] |
---|
417 | catalog_entry['mode'] = dsc['current_mode'] = da['entry_mode'] |
---|
418 | catalog_entry['course'] = dsc['study_course'] = cert_id |
---|
419 | catalog_entry['faculty'] = certificate['faculty'] |
---|
420 | catalog_entry['department'] = certificate['department'] |
---|
421 | catalog_entry['verdict'] = dsc['current_verdict'] = 'N/A' |
---|
422 | catalog_entry['review_state'] = self.portal_workflow.getInfoFor(student,'review_state',None) |
---|
423 | study_course.getContent().edit(mapping=dsc) |
---|
424 | #import pdb;pdb.set_trace() |
---|
425 | self.students_catalog.addRecord(**catalog_entry) |
---|
426 | if tr_count > 100: |
---|
427 | if len(no_import) > 0: |
---|
428 | open("%s/import/%s_not_imported.csv" % (i_home,name),"a").write( |
---|
429 | '\n'.join(no_import) + "\n") |
---|
430 | no_import = [] |
---|
431 | em = '%d transactions commited\n' % tr_count |
---|
432 | transaction.commit() |
---|
433 | logger.info(em) |
---|
434 | total += tr_count |
---|
435 | tr_count = 0 |
---|
436 | open("%s/import/%s_not_imported.csv" % (i_home,name),"a").write( |
---|
437 | '\n'.join(no_import)) |
---|
438 | return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) |
---|
439 | ###) |
---|
440 | |
---|
441 | security.declareProtected(ModifyPortalContent,"transferStudents")###( |
---|
442 | def transferStudents(self,filename): |
---|
443 | """ |
---|
444 | load Interfaculty transferStudents Studentdata from CSV values. |
---|
445 | """ |
---|
446 | import transaction |
---|
447 | import random |
---|
448 | current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") |
---|
449 | pm = self.portal_membership |
---|
450 | member = pm.getAuthenticatedMember() |
---|
451 | logger = logging.getLogger('Students.StudentsFolder.transferStudents') |
---|
452 | #students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject() |
---|
453 | students_folder = self.portal_url.getPortalObject().campus.students |
---|
454 | csv_fields = ('old_matric_no', |
---|
455 | 'matric_no', |
---|
456 | 'study_course', |
---|
457 | 'current_mode', |
---|
458 | 'current_level', |
---|
459 | ) |
---|
460 | tr_count = 0 |
---|
461 | total = 0 |
---|
462 | total_imported = 0 |
---|
463 | total_not_imported = 0 |
---|
464 | imported = [] |
---|
465 | not_imported = [] |
---|
466 | certs = {} |
---|
467 | try: |
---|
468 | results = csv.DictReader(open("%s/import/%s.csv" % (i_home,filename),"rb")) |
---|
469 | except: |
---|
470 | logger.error('Error reading %s.csv' % filename) |
---|
471 | return |
---|
472 | start = True |
---|
473 | for result in results: |
---|
474 | total += 1 |
---|
475 | if start: |
---|
476 | start = False |
---|
477 | logger.info('%s starts import from %s.csv' % (member,filename)) |
---|
478 | import_keys = [k for k in result.keys() if not k.startswith('ignore')] |
---|
479 | diff2schema = set(import_keys).difference(set(csv_fields)) |
---|
480 | if diff2schema: |
---|
481 | em = "not ignorable key(s) %s found in heading" % diff2schema |
---|
482 | return em |
---|
483 | s = ','.join(['"%s"' % fn for fn in import_keys]) |
---|
484 | open("%s/import/%s_not_imported%s.csv" % (i_home,filename,current),"a").write(s + ',"Error"'+ '\n') |
---|
485 | s = '"id",' + s |
---|
486 | open("%s/import/%s_imported%s.csv" % (i_home,filename,current),"a").write(s + '\n') |
---|
487 | format = ','.join(['"%%(%s)s"' % fn for fn in import_keys]) |
---|
488 | format_error = format + ',"%(Error)s"' |
---|
489 | format = '"%(id)s",'+ format |
---|
490 | old_matric_no = result.get('old_matric_no') |
---|
491 | res = self.students_catalog(matric_no = old_matric_no) |
---|
492 | result['id'] = "None" |
---|
493 | if not res: |
---|
494 | em = 'Student with matric_no %s not found' % old_matric_no |
---|
495 | logger.info(em) |
---|
496 | result['Error'] = "Student does not exist" |
---|
497 | not_imported.append(format_error % result) |
---|
498 | total_not_imported += 1 |
---|
499 | continue |
---|
500 | student_brain = res[0] |
---|
501 | student_object = getattr(students_folder,student_brain.id) |
---|
502 | result['id'] = student_brain.id |
---|
503 | cert_id = makeCertificateCode(result.get('study_course')) |
---|
504 | if cert_id not in certs.keys(): |
---|
505 | res = self.portal_catalog(meta_type = "Certificate",id = cert_id) |
---|
506 | if not res: |
---|
507 | em = 'No certificate with ID %s \n' % cert_id |
---|
508 | logger.info(em) |
---|
509 | result['Error'] = "No Certificate %s" % cert_id |
---|
510 | not_imported.append( format_error % result) |
---|
511 | total_not_imported += 1 |
---|
512 | continue |
---|
513 | cert = res[0] |
---|
514 | cert_path = cert.getPath().split('/') |
---|
515 | certificate = certs[cert_id] = {'faculty': cert_path[-4], |
---|
516 | 'department': cert_path[-3]} |
---|
517 | cert_doc = certs[cert_id] |
---|
518 | clearance = getattr(student_object,'clearance',None) |
---|
519 | if clearance is None: |
---|
520 | em = 'Student has no clearance object' |
---|
521 | logger.info(em) |
---|
522 | result['Error'] = em |
---|
523 | not_imported.append( format_error % result) |
---|
524 | total_not_imported += 1 |
---|
525 | continue |
---|
526 | clearance_doc = clearance.getContent() |
---|
527 | study_course = student_object.study_course |
---|
528 | study_course_doc = study_course.getContent() |
---|
529 | old_study_course = study_course_doc.study_course |
---|
530 | old_current_level = study_course_doc.current_level |
---|
531 | current_level = result.get('current_level',None) |
---|
532 | new_study_course = result.get('study_course',None) |
---|
533 | try: |
---|
534 | icl = int(current_level) |
---|
535 | except: |
---|
536 | em = 'Invalid new level %s' % current_level |
---|
537 | logger.info(em) |
---|
538 | result['Error'] = em |
---|
539 | not_imported.append( format_error % result) |
---|
540 | total_not_imported += 1 |
---|
541 | continue |
---|
542 | if icl == int(old_current_level) and old_study_course == new_study_course: |
---|
543 | em = 'Already transferred' |
---|
544 | logger.info(em) |
---|
545 | result['Error'] = em |
---|
546 | not_imported.append( format_error % result) |
---|
547 | total_not_imported += 1 |
---|
548 | continue |
---|
549 | if study_course.objectIds(): |
---|
550 | em = 'Already registered level %s for %s, but is supposed to study %s at level %s' % (old_current_level,old_study_course,new_study_course,current_level) |
---|
551 | logger.info(em) |
---|
552 | result['Error'] = em |
---|
553 | not_imported.append( format_error % result) |
---|
554 | total_not_imported += 1 |
---|
555 | continue |
---|
556 | #from pdb import set_trace; set_trace() |
---|
557 | cd = {} |
---|
558 | matric_no_history = getattr(clearance_doc,'matric_no_history',[]) |
---|
559 | if not matric_no_history: |
---|
560 | matric_no_history = [] |
---|
561 | matric_no_history.append(old_matric_no) |
---|
562 | cd['matric_no_history'] = matric_no_history |
---|
563 | cd['matric_no'] = result.get('matric_no') |
---|
564 | clearance_doc.edit(mapping = cd) |
---|
565 | dsc = {} |
---|
566 | study_course_history = getattr(study_course_doc,'study_course_history',[]) |
---|
567 | if not study_course_history: |
---|
568 | study_course_history = [] |
---|
569 | study_course_history.append(old_study_course) |
---|
570 | dsc['study_course_history'] = study_course_history |
---|
571 | dsc['study_course'] = new_study_course |
---|
572 | dsc['current_level'] = current_level |
---|
573 | dsc['current_mode'] = result.get('current_mode') |
---|
574 | study_course_doc.edit(mapping=dsc) |
---|
575 | imported.append( format % result) |
---|
576 | tr_count += 1 |
---|
577 | total_imported += 1 |
---|
578 | if tr_count > 1000: |
---|
579 | if len(not_imported) > 0: |
---|
580 | open("%s/import/%s_not_imported%s.csv" % (i_home,filename,current),"a").write( |
---|
581 | '\n'.join(not_imported) + '\n') |
---|
582 | not_imported = [] |
---|
583 | if len(imported) > 0: |
---|
584 | open("%s/import/%s_imported%s.csv" % (i_home,filename,current),"a").write( |
---|
585 | '\n'.join(imported) + '\n') |
---|
586 | imported = [] |
---|
587 | em = '%d transactions committed\n' % (tr_count) |
---|
588 | transaction.commit() |
---|
589 | regs = [] |
---|
590 | logger.info(em) |
---|
591 | tr_count = 0 |
---|
592 | if len(imported) > 0: |
---|
593 | open("%s/import/%s_imported%s.csv" % (i_home,filename,current),"a").write( |
---|
594 | '\n'.join(imported)) |
---|
595 | if len(not_imported) > 0: |
---|
596 | open("%s/import/%s_not_imported%s.csv" % (i_home,filename,current),"a").write( |
---|
597 | '\n'.join(not_imported)) |
---|
598 | em = "Imported: %d, not imported: %d of total %d" % (total_imported,total_not_imported,total) |
---|
599 | logger.info(em) |
---|
600 | return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) |
---|
601 | ###) |
---|
602 | |
---|
603 | security.declareProtected(ModifyPortalContent,"importReturningStudents")###( |
---|
604 | def importReturningStudents(self): |
---|
605 | """load Returning Studentdata from CSV values""" |
---|
606 | import transaction |
---|
607 | import random |
---|
608 | #from pdb import set_trace |
---|
609 | wftool = self.portal_workflow |
---|
610 | current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") |
---|
611 | #students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject() |
---|
612 | students_folder = self.portal_url.getPortalObject().campus.students |
---|
613 | tr_count = 1 |
---|
614 | total = 0 |
---|
615 | #name = 'pume_results' |
---|
616 | name = 'Returning' |
---|
617 | table = self.returning_import |
---|
618 | no_import = [] |
---|
619 | imported = [] |
---|
620 | logger = logging.getLogger('Students.StudentsFolder.importReturningStudents') |
---|
621 | try: |
---|
622 | returning = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) |
---|
623 | except: |
---|
624 | logger.error('Error reading %s.csv' % name) |
---|
625 | return |
---|
626 | l = self.portal_catalog({'meta_type': "Certificate"}) |
---|
627 | certs = {} |
---|
628 | cert_docs = {} |
---|
629 | for f in l: |
---|
630 | certs[f.getId] = f.getObject().getContent() |
---|
631 | start = True |
---|
632 | res = table() |
---|
633 | regs = [] |
---|
634 | if len(res) > 0: |
---|
635 | regs = [s.matric_no for s in res] |
---|
636 | #import pdb;pdb.set_trace() |
---|
637 | for student in returning: |
---|
638 | if start: |
---|
639 | start = False |
---|
640 | logger.info('Start loading from %s.csv' % name) |
---|
641 | s = ','.join(['"%s"' % fn for fn in student.keys()]) |
---|
642 | imported.append(s) |
---|
643 | no_import.append('%s,"Error"' % s) |
---|
644 | format = ','.join(['"%%(%s)s"' % fn for fn in student.keys()]) |
---|
645 | format_error = format + ',"%(Error)s"' |
---|
646 | no_certificate = "no certificate %s" % format |
---|
647 | student['matric_no'] = matric_no = student.get('matric_no').upper() |
---|
648 | student['Mode_of_Entry'] = entry_mode = student.get('Mode of Entry').upper() |
---|
649 | student['Permanent_Address'] = perm_address = student.get('Permanent Address') |
---|
650 | if matric_no == '': |
---|
651 | student['Error'] = "Empty matric_no" |
---|
652 | no_import.append( format_error % student) |
---|
653 | continue |
---|
654 | if matric_no in regs or self.returning_import(matric_no = matric_no): |
---|
655 | student['Error'] = "Duplicate" |
---|
656 | no_import.append( format_error % student) |
---|
657 | continue |
---|
658 | cert_id = makeCertificateCode(student.get('Coursemajorcode')) |
---|
659 | if cert_id not in certs.keys(): |
---|
660 | student['Error'] = "No Certificate %s" % cert_id |
---|
661 | no_import.append( format_error % student) |
---|
662 | continue |
---|
663 | try: |
---|
664 | table.addRecord(**student) |
---|
665 | except ValueError: |
---|
666 | student['Error'] = "Duplicate" |
---|
667 | no_import.append( format_error % student) |
---|
668 | continue |
---|
669 | regs.append(student.get('matric_no')) |
---|
670 | imported.append(format % student) |
---|
671 | tr_count += 1 |
---|
672 | if tr_count > 1000: |
---|
673 | if len(no_import) > 0: |
---|
674 | open("%s/import/%s_not_imported%s.csv" % (i_home,name,current),"a").write( |
---|
675 | '\n'.join(no_import) + '\n') |
---|
676 | no_import = [] |
---|
677 | open("%s/import/%simported%s.csv" % (i_home,name,current),"a").write( |
---|
678 | '\n'.join(no_import) + "\n") |
---|
679 | imported = [] |
---|
680 | em = '%d transactions commited total %s\n' % (tr_count,total) |
---|
681 | transaction.commit() |
---|
682 | regs = [] |
---|
683 | logger.info(em) |
---|
684 | total += tr_count |
---|
685 | tr_count = 0 |
---|
686 | open("%s/import/%simported%s.csv" % (i_home,name,current),"a").write( |
---|
687 | '\n'.join(imported)) |
---|
688 | open("%s/import/%s_not_imported%s.csv" % (i_home,name,current),"a").write( |
---|
689 | '\n'.join(no_import)) |
---|
690 | return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) |
---|
691 | ###) |
---|
692 | |
---|
693 | security.declareProtected(ModifyPortalContent,"fixAllNames")###( |
---|
694 | def fixAllNames(self): |
---|
695 | "fix all students names" |
---|
696 | import transaction |
---|
697 | response = self.REQUEST.RESPONSE |
---|
698 | logger = logging.getLogger('fixAllNames') |
---|
699 | logger.info('Start') |
---|
700 | students = self.portal_catalog(portal_type='Student') |
---|
701 | count = 0 |
---|
702 | total = 0 |
---|
703 | for student in students: |
---|
704 | scat_res = self.students_catalog(id = student.getId) |
---|
705 | if not scat_res: |
---|
706 | self.students_catalog.addRecord(id = student.getId) |
---|
707 | scat_res = self.students_catalog(id = student.getId) |
---|
708 | student_entry = scat_res[0] |
---|
709 | old_new = self.fixName(student,student_entry) |
---|
710 | count += 1 |
---|
711 | response_write(response,'"%d","%s",%s' % (count + total,student_entry.id,old_new)) |
---|
712 | if count > 2000: |
---|
713 | transaction.commit() |
---|
714 | logger.info("%d transactions commited" % count) |
---|
715 | total += count |
---|
716 | count = 0 |
---|
717 | ###) |
---|
718 | |
---|
719 | security.declareProtected(ModifyPortalContent,"fixName")###( |
---|
720 | def fixName(self,student_brain, student_entry): |
---|
721 | "fix the name of a student" |
---|
722 | fix = "first" |
---|
723 | if student_entry.get('name_fixed',None) == fix: |
---|
724 | return "Name already fixed" |
---|
725 | student_id = student_entry.id |
---|
726 | new_student = student_entry.jamb_reg_no.startswith('6') |
---|
727 | student_obj = student_brain.getObject() |
---|
728 | personal = getattr(student_obj,'personal',None) |
---|
729 | invalid = '' |
---|
730 | if personal is None: |
---|
731 | return '"%s","Returning","%s","%s"' % (invalid,student_entry.name,"not logged in") |
---|
732 | per_doc = personal.getContent() |
---|
733 | old_first = per_doc.firstname |
---|
734 | old_middle = per_doc.middlename |
---|
735 | old_last = per_doc.lastname |
---|
736 | new_first = '' |
---|
737 | new_middle = '' |
---|
738 | new_last = '' |
---|
739 | if new_student: |
---|
740 | if not old_first and not old_middle and old_last: |
---|
741 | new_names = [n.capitalize() for n in old_last.split()] |
---|
742 | if len(new_names) > 1: |
---|
743 | old_first = new_names[0] |
---|
744 | old_last = new_names[-1] |
---|
745 | old_middle = ' '.join(new_names[1:-1]) |
---|
746 | else: |
---|
747 | old_last = new_names[0] |
---|
748 | old_first = '' |
---|
749 | old_middle = '' |
---|
750 | if old_first: |
---|
751 | new_first = old_first |
---|
752 | if old_middle: |
---|
753 | new_middle = old_middle |
---|
754 | if old_last: |
---|
755 | new_last = old_last |
---|
756 | if old_first.find('<') != -1 or\ |
---|
757 | old_first.find('>') != -1 or\ |
---|
758 | old_middle.find('<') != -1 or\ |
---|
759 | old_middle.find('>') != -1 or\ |
---|
760 | old_last.find('<') != -1 or\ |
---|
761 | old_last.find('>') != -1: |
---|
762 | invalid = "invalid characters" |
---|
763 | else: |
---|
764 | new_first = old_first |
---|
765 | if new_first.strip() == '-': |
---|
766 | new_first = '' |
---|
767 | new_middle = old_middle |
---|
768 | if new_middle.strip() == '-': |
---|
769 | new_middle = '' |
---|
770 | new_last = old_last |
---|
771 | if new_last.strip() == '-': |
---|
772 | new_last = '' |
---|
773 | name = "%(new_first)s %(new_middle)s %(new_last)s" % vars() |
---|
774 | if new_student: |
---|
775 | text = "New" |
---|
776 | else: |
---|
777 | text = "Returning" |
---|
778 | old_new = '"%s","%s","%s","%s"' % (invalid,text, |
---|
779 | student_entry.name, |
---|
780 | name) |
---|
781 | if not invalid: |
---|
782 | self.students_catalog.modifyRecord(id = student_id, |
---|
783 | name_fixed = fix, |
---|
784 | name = name) |
---|
785 | per_doc.edit(mapping = {'firstname' : new_first, |
---|
786 | 'middlename' : new_middle, |
---|
787 | 'lastname' : new_last, |
---|
788 | }) |
---|
789 | return old_new |
---|
790 | ###) |
---|
791 | |
---|
792 | security.declareProtected(ModifyPortalContent,"updateReturningStudents")###( |
---|
793 | def updateReturningStudents(self): |
---|
794 | """load and overwrite Returning Student Data from CSV values""" |
---|
795 | import transaction |
---|
796 | import random |
---|
797 | #from pdb import set_trace |
---|
798 | wftool = self.portal_workflow |
---|
799 | current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") |
---|
800 | #students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject() |
---|
801 | students_folder = self.portal_url.getPortalObject().campus.students |
---|
802 | tr_count = 1 |
---|
803 | total = 0 |
---|
804 | #name = 'pume_results' |
---|
805 | name = 'Returning_update' |
---|
806 | table = self.returning_import |
---|
807 | no_import = [] |
---|
808 | imported = [] |
---|
809 | logger = logging.getLogger('Students.StudentsFolder.updateReturningStudents') |
---|
810 | try: |
---|
811 | returning = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) |
---|
812 | except: |
---|
813 | logger.error('Error reading %s.csv' % name) |
---|
814 | return |
---|
815 | l = self.portal_catalog({'meta_type': "Certificate"}) |
---|
816 | certs = {} |
---|
817 | cert_docs = {} |
---|
818 | for f in l: |
---|
819 | certs[f.getId] = f.getObject().getContent() |
---|
820 | start = True |
---|
821 | res = table() |
---|
822 | regs = [] |
---|
823 | if len(res) > 0: |
---|
824 | regs = [s.matric_no for s in res] |
---|
825 | for student in returning: |
---|
826 | if start: |
---|
827 | start = False |
---|
828 | logger.info('Start loading from %s.csv' % name) |
---|
829 | s = ','.join(['"%s"' % fn for fn in student.keys()]) |
---|
830 | imported.append(s) |
---|
831 | no_import.append('%s,"Error"' % s) |
---|
832 | format = ','.join(['"%%(%s)s"' % fn for fn in student.keys()]) |
---|
833 | format_error = format + ',"%(Error)s"' |
---|
834 | no_certificate = "no certificate %s" % format |
---|
835 | matric_no = student.get('matric_no').upper() |
---|
836 | student['matric_no'] = matric_no |
---|
837 | if matric_no == '': |
---|
838 | student['Error'] = "Empty matric_no" |
---|
839 | no_import.append( format_error % student) |
---|
840 | continue |
---|
841 | # if matric_no in regs or self.returning_import(matric_no = matric_no): |
---|
842 | # student['Error'] = "Duplicate" |
---|
843 | # no_import.append( format_error % student) |
---|
844 | # continue |
---|
845 | # cert_id = makeCertificateCode(student.get('Coursemajorcode')) |
---|
846 | # if cert_id not in certs.keys(): |
---|
847 | # student['Error'] = "No Certificate %s" % cert_id |
---|
848 | # no_import.append( format_error % student) |
---|
849 | # continue |
---|
850 | try: |
---|
851 | table.modifyRecord(**student) |
---|
852 | except KeyError: |
---|
853 | #import pdb;pdb.set_trace() |
---|
854 | student['Error'] = "no Student found to update" |
---|
855 | no_import.append( format_error % student) |
---|
856 | continue |
---|
857 | #s = self.students_catalog(matric_no=matric_no) |
---|
858 | #if s: |
---|
859 | # level = "%s" % (int(student.get('Level')) + 100) |
---|
860 | # self.students_catalog.modifyRecord(id = s[0].id, |
---|
861 | # level=level) |
---|
862 | |
---|
863 | regs.append(student.get('matric_no')) |
---|
864 | imported.append(format % student) |
---|
865 | tr_count += 1 |
---|
866 | if tr_count > 1000: |
---|
867 | if len(no_import) > 0: |
---|
868 | open("%s/import/%s_not_imported%s.csv" % (i_home,name,current),"a").write( |
---|
869 | '\n'.join(no_import) + '\n') |
---|
870 | no_import = [] |
---|
871 | open("%s/import/%simported%s.csv" % (i_home,name,current),"a").write( |
---|
872 | '\n'.join(no_import) + "\n") |
---|
873 | imported = [] |
---|
874 | em = '%d transactions commited total %s\n' % (tr_count,total) |
---|
875 | transaction.commit() |
---|
876 | regs = [] |
---|
877 | logger.info(em) |
---|
878 | total += tr_count |
---|
879 | tr_count = 0 |
---|
880 | open("%s/import/%simported%s.csv" % (i_home,name,current),"a").write( |
---|
881 | '\n'.join(imported)) |
---|
882 | open("%s/import/%s_not_imported%s.csv" % (i_home,name,current),"a").write( |
---|
883 | '\n'.join(no_import)) |
---|
884 | return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) |
---|
885 | ###) |
---|
886 | |
---|
887 | security.declareProtected(ModifyPortalContent,"importResults")###( |
---|
888 | def importResults(self): |
---|
889 | """load Returning Students Results from CSV""" |
---|
890 | import transaction |
---|
891 | import random |
---|
892 | #from pdb import set_trace |
---|
893 | wftool = self.portal_workflow |
---|
894 | current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") |
---|
895 | #students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject() |
---|
896 | students_folder = self.portal_url.getPortalObject().campus.students |
---|
897 | tr_count = 1 |
---|
898 | total = 0 |
---|
899 | #name = 'pume_results' |
---|
900 | name = 'Results' |
---|
901 | table = self.results_import |
---|
902 | no_import = [] |
---|
903 | imported = [] |
---|
904 | logger = logging.getLogger('Students.StudentsFolder.importResults') |
---|
905 | try: |
---|
906 | results = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) |
---|
907 | except: |
---|
908 | logger.error('Error reading %s.csv' % name) |
---|
909 | return |
---|
910 | l = self.portal_catalog({'meta_type': "Course"}) |
---|
911 | courses = [f.getId for f in l] |
---|
912 | start = True |
---|
913 | res = table() |
---|
914 | regs = [] |
---|
915 | if len(res) > 0: |
---|
916 | regs = [s.key for s in res] |
---|
917 | no_course = [] |
---|
918 | no_course_list = [] |
---|
919 | course_count = 0 |
---|
920 | for result in results: |
---|
921 | if start: |
---|
922 | start = False |
---|
923 | logger.info('Start loading from %s.csv' % name) |
---|
924 | s = ','.join(['"%s"' % fn for fn in result.keys()]) |
---|
925 | imported.append(s) |
---|
926 | no_import.append('%s,"Error"' % s) |
---|
927 | format = ','.join(['"%%(%s)s"' % fn for fn in result.keys()]) |
---|
928 | format_error = format + ',"%(Error)s"' |
---|
929 | no_certificate = "no certificate %s" % format |
---|
930 | course_id = result.get('CosCode') |
---|
931 | if not course_id: |
---|
932 | course_id = 'N/A' |
---|
933 | result['CosCode'] = course_id |
---|
934 | matric_no = result.get('matric_no').upper() |
---|
935 | result['matric_no'] = matric_no |
---|
936 | key = matric_no+course_id |
---|
937 | if matric_no == '': |
---|
938 | result['Error'] = "Empty matric_no" |
---|
939 | no_import.append( format_error % result) |
---|
940 | continue |
---|
941 | if key in regs or self.results_import(key = key): |
---|
942 | result['Error'] = "Duplicate" |
---|
943 | no_import.append( format_error % result) |
---|
944 | continue |
---|
945 | if course_id not in courses: |
---|
946 | if course_id not in no_course: |
---|
947 | course_count +=1 |
---|
948 | no_course.append(course_id) |
---|
949 | no_course_list.append('"%s"' % course_id) |
---|
950 | #result['Error'] = "No Course" |
---|
951 | #logger.info(format_error % result) |
---|
952 | |
---|
953 | result['key'] = key |
---|
954 | try: |
---|
955 | table.addRecord(**result) |
---|
956 | except ValueError: |
---|
957 | #import pdb;pdb.set_trace() |
---|
958 | result['Error'] = "Duplicate" |
---|
959 | no_import.append( format_error % result) |
---|
960 | continue |
---|
961 | |
---|
962 | regs.append(key) |
---|
963 | imported.append(format % result) |
---|
964 | tr_count += 1 |
---|
965 | if tr_count > 1000: |
---|
966 | if len(no_import) > 0: |
---|
967 | open("%s/import/%s_not_imported%s.csv" % (i_home,name,current),"a").write( |
---|
968 | '\n'.join(no_import)+'\n') |
---|
969 | no_import = [] |
---|
970 | open("%s/import/%simported%s.csv" % (i_home,name,current),"a").write( |
---|
971 | '\n'.join(imported) + '\n') |
---|
972 | imported = [] |
---|
973 | if no_course_list: |
---|
974 | open("%s/import/%sno_courses%s.csv" % (i_home,name,current),"a").write( |
---|
975 | '\n'.join(no_course_list) + '\n') |
---|
976 | no_course_list = [] |
---|
977 | em = '%d transactions commited total %s\n courses not found %s' % (tr_count,total,course_count) |
---|
978 | transaction.commit() |
---|
979 | logger.info(em) |
---|
980 | regs = [] |
---|
981 | total += tr_count |
---|
982 | tr_count = 0 |
---|
983 | open("%s/import/%simported%s.csv" % (i_home,name,current),"a").write( |
---|
984 | '\n'.join(imported)) |
---|
985 | open("%s/import/%s_not_imported%s.csv" % (i_home,name,current),"a").write( |
---|
986 | '\n'.join(no_import)) |
---|
987 | if no_course_list: |
---|
988 | open("%s/import/%sno_courses%s.csv" % (i_home,name,current),"a").write( |
---|
989 | '\n'.join(no_course_list)) |
---|
990 | em = '%d transactions commited total %s\n courses not found %s' % (tr_count,total,course_count) |
---|
991 | logger.info(em) |
---|
992 | return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) |
---|
993 | ###) |
---|
994 | |
---|
995 | security.declareProtected(ModifyPortalContent,"updateStudyCourse")###( |
---|
996 | def updateStudyCourse(self): |
---|
997 | """update StudyCourse from CSV values""" |
---|
998 | import transaction |
---|
999 | import random |
---|
1000 | from pdb import set_trace |
---|
1001 | wftool = self.portal_workflow |
---|
1002 | #students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject() |
---|
1003 | students_folder = self.portal_url.getPortalObject().campus.students |
---|
1004 | csv_d = {'jamb_reg_no': "RegNumber", |
---|
1005 | 'jamb_lastname': "Name", |
---|
1006 | 'session': "Session", |
---|
1007 | 'pume_tot_score': "PUME SCORE", |
---|
1008 | 'jamb_score': "JambScore", |
---|
1009 | 'jamb_sex': "Sex", |
---|
1010 | 'jamb_state': "State", |
---|
1011 | ## 'jamb_first_cos': "AdminCourse", |
---|
1012 | 'faculty': "AdminFaculty", |
---|
1013 | 'course_code': "AdmitCoscode", |
---|
1014 | 'stud_status':"AdmitStatus", |
---|
1015 | 'department': "AdmitDept", |
---|
1016 | 'jamb_lga': "LGA", |
---|
1017 | 'app_email': "email", |
---|
1018 | 'app_mobile': "PhoneNumbers", |
---|
1019 | } |
---|
1020 | csv_fields = [f[1] for f in csv_d.items()] |
---|
1021 | tr_count = 0 |
---|
1022 | total = 0 |
---|
1023 | #name = 'pume_results' |
---|
1024 | name = 'StudyCourseChange' |
---|
1025 | no_import = [] |
---|
1026 | s = ','.join(['"%s"' % fn for fn in csv_fields]) |
---|
1027 | no_import.append('"Error",%s' % s) |
---|
1028 | format = '"%(Error)s",' + ','.join(['"%%(%s)s"' % fn for fn in csv_fields]) |
---|
1029 | no_certificate = "no certificate %s" % format |
---|
1030 | open("%s/import/%s_not_imported.csv" % (i_home,name),"w").write( |
---|
1031 | '\n'.join(no_import)) |
---|
1032 | logger = logging.getLogger('Students.StudentsFolder.updateStudyCourse') |
---|
1033 | logger.info('Start loading from %s.csv' % name) |
---|
1034 | l = self.portal_catalog({'meta_type': "Certificate"}) |
---|
1035 | try: |
---|
1036 | result = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) |
---|
1037 | except: |
---|
1038 | logger.error('Error reading %s.csv' % name) |
---|
1039 | return |
---|
1040 | for jamb in result: |
---|
1041 | jamb['Error'] = "Processing " |
---|
1042 | logger.info(format % jamb) |
---|
1043 | jamb_reg_no = jamb.get(csv_d['jamb_reg_no']) |
---|
1044 | res = self.portal_catalog({'portal_type': "StudentApplication", |
---|
1045 | 'SearchableText': jamb_reg_no }) |
---|
1046 | if not res: |
---|
1047 | em = 'Student with jamb_reg_no %s does not exists\n' % jamb_reg_no |
---|
1048 | logger.info(em) |
---|
1049 | jamb['Error'] = "Student does not exist" |
---|
1050 | no_import.append(format % jamb) |
---|
1051 | continue |
---|
1052 | sid = res[0].getPath().split('/')[-2] |
---|
1053 | cert_id = makeCertificateCode(jamb.get(csv_d['course_code'])) |
---|
1054 | res = self.portal_catalog(portal_type = "Certificate", id = cert_id) |
---|
1055 | if not res: |
---|
1056 | em = 'No Certificate with ID %s \n' % cert_id |
---|
1057 | logger.info(em) |
---|
1058 | jamb['Error'] = "No Certificate %s" % cert_id |
---|
1059 | no_import.append( format % jamb) |
---|
1060 | continue |
---|
1061 | cert_brain = res[0] |
---|
1062 | catalog_entry = {} |
---|
1063 | student = getattr(self,sid) |
---|
1064 | # |
---|
1065 | # Study Course |
---|
1066 | # |
---|
1067 | study_course = student.study_course |
---|
1068 | dsc = {} |
---|
1069 | cert_pl = cert_brain.getPath().split('/') |
---|
1070 | catalog_entry['id'] = sid |
---|
1071 | catalog_entry['faculty'] = cert_pl[-4] |
---|
1072 | catalog_entry['department'] = cert_pl[-3] |
---|
1073 | catalog_entry['course'] = cert_id |
---|
1074 | dsc['study_course'] = cert_id |
---|
1075 | study_course.getContent().edit(mapping=dsc) |
---|
1076 | self.students_catalog.modifyRecord(**catalog_entry) |
---|
1077 | if tr_count > 10: |
---|
1078 | if len(no_import) > 1: |
---|
1079 | open("%s/import/%s_not_imported.csv" % (i_home,name),"w+").write( |
---|
1080 | '\n'.join(no_import)) |
---|
1081 | no_import = [] |
---|
1082 | em = '%d transactions commited\n' % tr_count |
---|
1083 | transaction.commit() |
---|
1084 | logger.info(em) |
---|
1085 | total += tr_count |
---|
1086 | tr_count = 0 |
---|
1087 | tr_count += 1 |
---|
1088 | return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) |
---|
1089 | ###) |
---|
1090 | |
---|
1091 | security.declareProtected(View,"fixOwnership") ###( |
---|
1092 | def fixOwnership(self): |
---|
1093 | """fix Ownership""" |
---|
1094 | for s in self.portal_catalog(meta_type = 'Student'): |
---|
1095 | student = s.getObject() |
---|
1096 | sid = s.getId |
---|
1097 | import pdb;pdb.set_trace() |
---|
1098 | student.application.manage_setLocalRoles(sid, ['Owner',]) |
---|
1099 | student.personal.manage_setLocalRoles(sid, ['Owner',]) |
---|
1100 | ###) |
---|
1101 | |
---|
1102 | security.declareProtected(View,"Title") ###( |
---|
1103 | def Title(self): |
---|
1104 | """compose title""" |
---|
1105 | return "Student Section" |
---|
1106 | ###) |
---|
1107 | |
---|
1108 | def generateStudentId(self,letter,students = None): ###( |
---|
1109 | import random |
---|
1110 | r = random |
---|
1111 | if students is None: |
---|
1112 | students = self.portal_url.getPortalObject().campus.students |
---|
1113 | if letter not in ('ABCDEFGIHKLMNOPQRSTUVWXY'): |
---|
1114 | letter= r.choice('ABCDEFGHKLMNPQRSTUVWXY') |
---|
1115 | sid = "%c%d" % (letter,r.randint(99999,1000000)) |
---|
1116 | while hasattr(students, sid): |
---|
1117 | sid = "%c%d" % (letter,r.randint(99999,1000000)) |
---|
1118 | return sid |
---|
1119 | #return "%c%d" % (r.choice('ABCDEFGHKLMNPQRSTUVWXY'),r.randint(99999,1000000)) |
---|
1120 | ###) |
---|
1121 | |
---|
1122 | InitializeClass(StudentsFolder) |
---|
1123 | |
---|
1124 | def addStudentsFolder(container, id, REQUEST=None, **kw): ###( |
---|
1125 | """Add a Student.""" |
---|
1126 | ob = StudentsFolder(id, **kw) |
---|
1127 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
1128 | ###) |
---|
1129 | |
---|
1130 | ###) |
---|
1131 | |
---|
1132 | class Student(CPSDocument): ###( |
---|
1133 | """ |
---|
1134 | WAeUP Student container for the various student data |
---|
1135 | """ |
---|
1136 | meta_type = 'Student' |
---|
1137 | portal_type = meta_type |
---|
1138 | security = ClassSecurityInfo() |
---|
1139 | |
---|
1140 | security.declareProtected(View,"Title") |
---|
1141 | def Title(self): |
---|
1142 | """compose title""" |
---|
1143 | reg_nr = self.getId()[1:] |
---|
1144 | data = getattr(self,'personal',None) |
---|
1145 | if data: |
---|
1146 | content = data.getContent() |
---|
1147 | return "%s %s %s" % (content.firstname,content.middlename,content.lastname) |
---|
1148 | data = getattr(self,'application',None) |
---|
1149 | if data: |
---|
1150 | content = data.getContent() |
---|
1151 | return "%s" % (content.jamb_lastname) |
---|
1152 | return self.title |
---|
1153 | |
---|
1154 | security.declarePrivate('makeStudentMember') ###( |
---|
1155 | def makeStudentMember(self,sid,password='uNsEt'): |
---|
1156 | """make the student a member""" |
---|
1157 | membership = self.portal_membership |
---|
1158 | membership.addMember(sid, |
---|
1159 | password , |
---|
1160 | roles=('Member', |
---|
1161 | 'Student', |
---|
1162 | ), |
---|
1163 | domains='', |
---|
1164 | properties = {'memberareaCreationFlag': False, |
---|
1165 | 'homeless': True},) |
---|
1166 | member = membership.getMemberById(sid) |
---|
1167 | self.portal_registration.afterAdd(member, sid, password, None) |
---|
1168 | self.manage_setLocalRoles(sid, ['Owner',]) |
---|
1169 | |
---|
1170 | ###) |
---|
1171 | |
---|
1172 | security.declareProtected(View,'createSubObjects') ###( |
---|
1173 | def createSubObjects(self): |
---|
1174 | """make the student a member""" |
---|
1175 | dp = {'Title': 'Personal Data'} |
---|
1176 | app_doc = self.application.getContent() |
---|
1177 | names = app_doc.jamb_lastname.split() |
---|
1178 | if len(names) == 3: |
---|
1179 | dp['firstname'] = names[0].capitalize() |
---|
1180 | dp['middlename'] = names[1].capitalize() |
---|
1181 | dp['lastname'] = names[2].capitalize() |
---|
1182 | elif len(names) == 2: |
---|
1183 | dp['firstname'] = names[0].capitalize() |
---|
1184 | dp['lastname'] = names[1].capitalize() |
---|
1185 | else: |
---|
1186 | dp['lastname'] = app_doc.jamb_lastname |
---|
1187 | dp['sex'] = app_doc.jamb_sex == 'F' |
---|
1188 | dp['lga'] = "%s/%s" % (app_doc.jamb_state,app_doc.jamb_lga ) |
---|
1189 | proxy = self.aq_parent |
---|
1190 | proxy.invokeFactory('StudentPersonal','personal') |
---|
1191 | per = proxy.personal |
---|
1192 | per_doc = per.getContent() |
---|
1193 | per_doc.edit(mapping = dp) |
---|
1194 | per.manage_setLocalRoles(proxy.getId(), ['Owner',]) |
---|
1195 | #self.portal_workflow.doActionFor(per,'open',dest_container=per) |
---|
1196 | |
---|
1197 | ###) |
---|
1198 | |
---|
1199 | InitializeClass(Student) |
---|
1200 | |
---|
1201 | def addStudent(container, id, REQUEST=None, **kw): |
---|
1202 | """Add a Student.""" |
---|
1203 | ob = Student(id, **kw) |
---|
1204 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
1205 | |
---|
1206 | ###) |
---|
1207 | |
---|
1208 | class StudentAccommodation(CPSDocument): ###( |
---|
1209 | """ |
---|
1210 | WAeUP Student container for the various student data |
---|
1211 | """ |
---|
1212 | meta_type = 'StudentAccommodation' |
---|
1213 | portal_type = meta_type |
---|
1214 | security = ClassSecurityInfo() |
---|
1215 | |
---|
1216 | security.declareProtected(View,"Title") |
---|
1217 | def Title(self): |
---|
1218 | """compose title""" |
---|
1219 | content = self.getContent() |
---|
1220 | #return "Accommodation Data for %s %s" % (content.firstname,content.lastname) |
---|
1221 | return "Accommodation Data for Session %s" % content.session |
---|
1222 | |
---|
1223 | |
---|
1224 | InitializeClass(StudentAccommodation) |
---|
1225 | |
---|
1226 | def addStudentAccommodation(container, id, REQUEST=None, **kw): |
---|
1227 | """Add a Students personal data.""" |
---|
1228 | ob = StudentAccommodation(id, **kw) |
---|
1229 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
1230 | |
---|
1231 | ###) |
---|
1232 | |
---|
1233 | class StudentPersonal(CPSDocument): ###( |
---|
1234 | """ |
---|
1235 | WAeUP Student container for the various student data |
---|
1236 | """ |
---|
1237 | meta_type = 'StudentPersonal' |
---|
1238 | portal_type = meta_type |
---|
1239 | security = ClassSecurityInfo() |
---|
1240 | |
---|
1241 | security.declareProtected(View,"Title") |
---|
1242 | def Title(self): |
---|
1243 | """compose title""" |
---|
1244 | content = self.getContent() |
---|
1245 | #return "Personal Data for %s %s" % (content.firstname,content.lastname) |
---|
1246 | return "Personal Data" |
---|
1247 | |
---|
1248 | |
---|
1249 | InitializeClass(StudentPersonal) |
---|
1250 | |
---|
1251 | def addStudentPersonal(container, id, REQUEST=None, **kw): |
---|
1252 | """Add a Students personal data.""" |
---|
1253 | ob = StudentPersonal(id, **kw) |
---|
1254 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
1255 | |
---|
1256 | ###) |
---|
1257 | |
---|
1258 | class StudentClearance(CPSDocument): ###( |
---|
1259 | """ |
---|
1260 | WAeUP Student container for the various student data |
---|
1261 | """ |
---|
1262 | meta_type = 'StudentClearance' |
---|
1263 | portal_type = meta_type |
---|
1264 | security = ClassSecurityInfo() |
---|
1265 | |
---|
1266 | security.declareProtected(View,"Title") |
---|
1267 | def Title(self): |
---|
1268 | """compose title""" |
---|
1269 | content = self.getContent() |
---|
1270 | #return "Clearance/Eligibility Record for %s %s" % (content.firstname,content.lastname) |
---|
1271 | return "Clearance/Eligibility Record" |
---|
1272 | |
---|
1273 | |
---|
1274 | InitializeClass(StudentClearance) |
---|
1275 | |
---|
1276 | def addStudentClearance(container, id, REQUEST=None, **kw): |
---|
1277 | """Add a Students personal data.""" |
---|
1278 | ob = StudentClearance(id, **kw) |
---|
1279 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
1280 | |
---|
1281 | ###) |
---|
1282 | |
---|
1283 | class StudentStudyLevel(CPSDocument): ###( |
---|
1284 | """ |
---|
1285 | WAeUP Student container for the various student data |
---|
1286 | """ |
---|
1287 | meta_type = 'StudentStudyLevel' |
---|
1288 | portal_type = meta_type |
---|
1289 | security = ClassSecurityInfo() |
---|
1290 | |
---|
1291 | security.declareProtected(View,"Title") |
---|
1292 | def Title(self): |
---|
1293 | """compose title""" |
---|
1294 | return "Level %s" % self.aq_parent.getId() |
---|
1295 | |
---|
1296 | def create_course_results(self,cert_id,current_level): ###( |
---|
1297 | "create all courses in a level" |
---|
1298 | aq_portal = self.portal_catalog.evalAdvancedQuery |
---|
1299 | res = self.portal_catalog(portal_type="Certificate", id = cert_id) |
---|
1300 | l = [] |
---|
1301 | import transaction |
---|
1302 | if res: |
---|
1303 | cert = res[0] |
---|
1304 | path = cert.getPath() |
---|
1305 | query = Eq("path","%s/%s" % (path,current_level)) &\ |
---|
1306 | Eq('portal_type','CertificateCourse') |
---|
1307 | courses = aq_portal(query) |
---|
1308 | #from pdb import set_trace;set_trace() |
---|
1309 | self_proxy = self.aq_parent |
---|
1310 | for c in courses: |
---|
1311 | d = self.getCourseInfo(c.getId) |
---|
1312 | cr_id = self_proxy.invokeFactory('StudentCourseResult',c.getId) |
---|
1313 | course_result = getattr(self_proxy,cr_id) |
---|
1314 | self.portal_workflow.doActionFor(course_result,'open') |
---|
1315 | d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective') |
---|
1316 | course_result.getContent().edit(mapping=d) |
---|
1317 | #transaction.commit() |
---|
1318 | ###) |
---|
1319 | |
---|
1320 | InitializeClass(StudentStudyLevel) |
---|
1321 | |
---|
1322 | def addStudentStudyLevel(container, id, REQUEST=None, **kw): |
---|
1323 | """Add a Students personal data.""" |
---|
1324 | ob = StudentStudyLevel(id, **kw) |
---|
1325 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
1326 | |
---|
1327 | ###) |
---|
1328 | |
---|
1329 | class StudentStudyCourse(CPSDocument): ###( |
---|
1330 | """ |
---|
1331 | WAeUP Student container for the various student data |
---|
1332 | """ |
---|
1333 | meta_type = 'StudentStudyCourse' |
---|
1334 | portal_type = meta_type |
---|
1335 | security = ClassSecurityInfo() |
---|
1336 | |
---|
1337 | security.declareProtected(View,"Title") |
---|
1338 | def Title(self): |
---|
1339 | """compose title""" |
---|
1340 | content = self.getContent() |
---|
1341 | return "Study Course" |
---|
1342 | |
---|
1343 | |
---|
1344 | InitializeClass(StudentStudyCourse) |
---|
1345 | |
---|
1346 | def addStudentStudyCourse(container, id, REQUEST=None, **kw): |
---|
1347 | """Add a Students personal data.""" |
---|
1348 | ob = StudentStudyCourse(id, **kw) |
---|
1349 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
1350 | |
---|
1351 | ###) |
---|
1352 | |
---|
1353 | class StudentApplication(CPSDocument): ###( |
---|
1354 | """ |
---|
1355 | WAeUP Student container for the various student data |
---|
1356 | """ |
---|
1357 | meta_type = 'StudentApplication' |
---|
1358 | portal_type = meta_type |
---|
1359 | security = ClassSecurityInfo() |
---|
1360 | |
---|
1361 | security.declareProtected(View,"Title") |
---|
1362 | def Title(self): |
---|
1363 | """compose title""" |
---|
1364 | return "Application Data" |
---|
1365 | |
---|
1366 | |
---|
1367 | InitializeClass(StudentApplication) |
---|
1368 | |
---|
1369 | def addStudentApplication(container, id, REQUEST=None, **kw): |
---|
1370 | """Add a Students eligibility data.""" |
---|
1371 | ob = StudentApplication(id, **kw) |
---|
1372 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
1373 | ###) |
---|
1374 | |
---|
1375 | class StudentPume(CPSDocument): ###( |
---|
1376 | """ |
---|
1377 | WAeUP Student container for the various student data |
---|
1378 | """ |
---|
1379 | meta_type = 'StudentPume' |
---|
1380 | portal_type = meta_type |
---|
1381 | security = ClassSecurityInfo() |
---|
1382 | |
---|
1383 | security.declareProtected(View,"Title") |
---|
1384 | def Title(self): |
---|
1385 | """compose title""" |
---|
1386 | return "PUME Results" |
---|
1387 | |
---|
1388 | |
---|
1389 | InitializeClass(StudentPume) |
---|
1390 | |
---|
1391 | def addStudentPume(container, id, REQUEST=None, **kw): |
---|
1392 | """Add a Students PUME data.""" |
---|
1393 | ob = StudentPume(id, **kw) |
---|
1394 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
1395 | ###) |
---|
1396 | |
---|
1397 | ##class StudentSemester(CPSDocument): ###( |
---|
1398 | ## """ |
---|
1399 | ## WAeUP StudentSemester containing the courses and students |
---|
1400 | ## """ |
---|
1401 | ## meta_type = 'StudentSemester' |
---|
1402 | ## portal_type = meta_type |
---|
1403 | ## security = ClassSecurityInfo() |
---|
1404 | ## |
---|
1405 | ##InitializeClass(StudentSemester) |
---|
1406 | ## |
---|
1407 | ##def addStudentSemester(container, id, REQUEST=None, **kw): |
---|
1408 | ## """Add a StudentSemester.""" |
---|
1409 | ## ob = StudentSemester(id, **kw) |
---|
1410 | ## return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
1411 | ## |
---|
1412 | #####) |
---|
1413 | |
---|
1414 | ##class Semester(CPSDocument): ###( |
---|
1415 | ## """ |
---|
1416 | ## WAeUP Semester containing the courses and students |
---|
1417 | ## """ |
---|
1418 | ## meta_type = 'Semester' |
---|
1419 | ## portal_type = meta_type |
---|
1420 | ## security = ClassSecurityInfo() |
---|
1421 | ## |
---|
1422 | ##InitializeClass(Semester) |
---|
1423 | ## |
---|
1424 | ##def addSemester(container, id, REQUEST=None, **kw): |
---|
1425 | ## """Add a Semester.""" |
---|
1426 | ## ob = Semester(id, **kw) |
---|
1427 | ## return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
1428 | ## |
---|
1429 | #####) |
---|
1430 | |
---|
1431 | class StudentCourseResult(CPSDocument): ###( |
---|
1432 | """ |
---|
1433 | WAeUP StudentCourseResult |
---|
1434 | """ |
---|
1435 | meta_type = 'StudentCourseResult' |
---|
1436 | portal_type = meta_type |
---|
1437 | security = ClassSecurityInfo() |
---|
1438 | |
---|
1439 | def getCourseEntry(self,cid): |
---|
1440 | res = self.portal_catalog({'meta_type': "Course", |
---|
1441 | 'id': cid}) |
---|
1442 | if res: |
---|
1443 | return res[-1] |
---|
1444 | else: |
---|
1445 | return None |
---|
1446 | |
---|
1447 | security.declareProtected(View,"Title") |
---|
1448 | def Title(self): |
---|
1449 | """compose title""" |
---|
1450 | cid = self.aq_parent.getId() |
---|
1451 | ce = self.getCourseEntry(cid) |
---|
1452 | if ce: |
---|
1453 | return "%s" % ce.Title |
---|
1454 | return "No course with id %s" % cid |
---|
1455 | |
---|
1456 | InitializeClass(StudentCourseResult) |
---|
1457 | |
---|
1458 | def addStudentCourseResult(container, id, REQUEST=None, **kw): |
---|
1459 | """Add a StudentCourseResult.""" |
---|
1460 | ob = StudentCourseResult(id, **kw) |
---|
1461 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
1462 | ###) |
---|
1463 | |
---|
1464 | # Backward Compatibility StudyLevel |
---|
1465 | |
---|
1466 | from Products.WAeUP_SRP.Academics import StudyLevel |
---|
1467 | |
---|
1468 | from Products.WAeUP_SRP.Academics import addStudyLevel |
---|
1469 | |
---|