1 | #-*- mode: python; mode: fold -*- |
---|
2 | # $Id: Students.py 446 2006-08-29 17:43:05Z joachim $ |
---|
3 | from Globals import InitializeClass |
---|
4 | from AccessControl import ClassSecurityInfo |
---|
5 | from AccessControl.SecurityManagement import newSecurityManager |
---|
6 | from zExceptions import BadRequest |
---|
7 | from Products.CMFCore.utils import UniqueObject, getToolByName |
---|
8 | from Products.CMFCore.permissions import View |
---|
9 | from Products.CMFCore.permissions import ModifyPortalContent |
---|
10 | from Products.CPSCore.CPSBase import CPSBase_adder, CPSBaseFolder |
---|
11 | #from Products.CPSCore.CPSBase import CPSBaseDocument as BaseDocument |
---|
12 | from Products.CPSDocument.CPSDocument import CPSDocument |
---|
13 | from Products.CPSCore.CPSBase import CPSBaseBTreeFolder as BaseBTreeFolder |
---|
14 | from Products.CPSCore.CPSMembershipTool import CPSUnrestrictedUser |
---|
15 | from Products.WAeUP_SRP.Academics import makeCertificateCode |
---|
16 | import logging |
---|
17 | import csv,re |
---|
18 | import Globals |
---|
19 | p_home = Globals.package_home(globals()) |
---|
20 | i_home = Globals.INSTANCE_HOME |
---|
21 | MAX_TRANS = 1000 |
---|
22 | |
---|
23 | def generateStudentId(): |
---|
24 | import random |
---|
25 | r = random |
---|
26 | return "%c%d" % (r.choice('ABCDEFGHKLMNPQRSTUVWXY'),r.randint(99999,1000000)) |
---|
27 | |
---|
28 | class StudentsFolder(CPSDocument): ###( |
---|
29 | """ |
---|
30 | WAeUP container for the various WAeUP containers data |
---|
31 | """ |
---|
32 | meta_type = 'StudentsFolder' |
---|
33 | portal_type = meta_type |
---|
34 | security = ClassSecurityInfo() |
---|
35 | |
---|
36 | security.declareProtected(ModifyPortalContent,"loadFullTimeStudentsFromCSV")###( |
---|
37 | def loadFullTimeStudentsFromCSV(self): |
---|
38 | """load Fulltime Studentdata from CSV values""" |
---|
39 | #return |
---|
40 | import transaction |
---|
41 | tr_count = 0 |
---|
42 | name = 'short_full_time' |
---|
43 | no_import = False |
---|
44 | if not no_import: |
---|
45 | no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w") |
---|
46 | no_import.write('"MatricNo","EntryRegNo","CurrentSession","StudentLevel","fullname","FirstName","MiddleName","Lastname","FormerSurname","Sex","Nationality","State","LGA","PermanentAddress","PermanentAddressCity","CampusAddress","PhoneNumber","Emailaddress","Mode","CourseMajor","Faculty","Dept"\n') |
---|
47 | logger = logging.getLogger('%s_import' % name) |
---|
48 | logger.info('Start loading from %s.csv' % name) |
---|
49 | students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject() |
---|
50 | try: |
---|
51 | students = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) |
---|
52 | except: |
---|
53 | logger.error('Error reading %s.csv' % name) |
---|
54 | return |
---|
55 | l = self.portal_catalog({'meta_type': "StudentClearance",}) |
---|
56 | matrics = [] |
---|
57 | for s in l: |
---|
58 | matrics.append(s.getObject().getContent().matric_no) |
---|
59 | print matrics |
---|
60 | l = self.portal_catalog({'meta_type': "Certificate"}) |
---|
61 | certs = {} |
---|
62 | for c in l: |
---|
63 | certs[c.id] = c.getObject() |
---|
64 | for student in students: |
---|
65 | 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) |
---|
66 | sid = student.get('MatricNo') |
---|
67 | if sid == "": |
---|
68 | em = 'Empty MatricNo\n' |
---|
69 | logger.info(em) |
---|
70 | no_import.write(em) |
---|
71 | 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) |
---|
72 | continue |
---|
73 | certcode = makeCertificateCode(student.get('CourseMajor')) |
---|
74 | if certcode not in certs.keys(): |
---|
75 | em = 'Certificate with ID %s %s not found\n' % (certcode, student.get('CourseMajor')) |
---|
76 | logger.info(em) |
---|
77 | no_import.write(em) |
---|
78 | 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) |
---|
79 | continue |
---|
80 | level = student.get('StudentLevel') |
---|
81 | try: |
---|
82 | int(level) |
---|
83 | except: |
---|
84 | em = 'Student with ID %(MatricNo)s StudentLevel is empty\n' % student |
---|
85 | logger.info(em) |
---|
86 | no_import.write(em) |
---|
87 | 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) |
---|
88 | continue |
---|
89 | matric_no = student.get('MatricNo') |
---|
90 | if matric_no not in matrics: |
---|
91 | matrics.append(matric_no) |
---|
92 | sid = generateStudentId() |
---|
93 | #self.log('Creating Faculty %(id)s = %(Title)s' % faculty) |
---|
94 | logger.info('%(tr_count)s: Creating Student with ID %(sid)s Matric_no %(matric_no)s ' % vars()) |
---|
95 | not_created = True |
---|
96 | while not_created: |
---|
97 | try: |
---|
98 | students_folder.invokeFactory('Student', sid) |
---|
99 | not_created = False |
---|
100 | except BadRequest: |
---|
101 | sid = generateStudentId() |
---|
102 | logger.info('%(tr_count)s: Creating Student with ID %(sid)s Matric_no %(matric_no)s ' % vars()) |
---|
103 | s = getattr(self,sid) |
---|
104 | s.invokeFactory('StudentAdmission','admission') |
---|
105 | da = {'Title': 'Admission Data'} |
---|
106 | s.invokeFactory('StudentPersonal','personal') |
---|
107 | da['jamb_reg_no'] = student.get('EntryRegNo') |
---|
108 | sp = s.personal |
---|
109 | d = {'Title': 'Personal Data'} |
---|
110 | s.invokeFactory('StudentClearance','clearance') |
---|
111 | sc = s.clearance |
---|
112 | dc = {'Title': 'Clearance Data'} |
---|
113 | dc['matric_no'] = matric_no |
---|
114 | lga = student.get('State') + ' / ' + student.get('LGA') |
---|
115 | dc['lga'] = lga |
---|
116 | dc['nationality'] = student.get('Nationality') |
---|
117 | dc['email'] = student.get('Emailaddress') |
---|
118 | d['firstname'] = student.get('FirstName') |
---|
119 | d['middlename'] = student.get('MiddleName') |
---|
120 | d['lastname'] = student.get('Lastname') |
---|
121 | d['former_surname'] = student.get('FormerSurname') |
---|
122 | d['sex'] = student.get('Sex') == 'F' |
---|
123 | d['perm_address'] = student.get('PermanentAddress') |
---|
124 | d['perm_city'] = student.get('PermanentAddressCity') |
---|
125 | d['campus_address'] = student.get('CampusAddress') |
---|
126 | d['phone'] = student.get('PhoneNumber') |
---|
127 | s.admission.getContent().edit(mapping=da) |
---|
128 | sp.getContent().edit(mapping=d) |
---|
129 | sc.getContent().edit(mapping=dc) |
---|
130 | # |
---|
131 | # Study Course |
---|
132 | # |
---|
133 | s.invokeFactory('StudentStudyCourse','study_course') |
---|
134 | sc = s.study_course |
---|
135 | d = {} |
---|
136 | #d['matricel_no'] = student.get('MatricNo') |
---|
137 | #d['entry_reg_no'] = student.get('EntryRegNo') |
---|
138 | #d['faculty'] = student.get('Faculty') |
---|
139 | #d['department'] = student.get('Dept') |
---|
140 | d['course_major'] = certcode |
---|
141 | css = student.get('CurrentSession') or '2004-2005' |
---|
142 | cs = int(css.split('-')[0]) - 2000 |
---|
143 | cl = int(student.get('StudentLevel'))/100 |
---|
144 | d['entry_session'] = "200%s" % (cs - cl) |
---|
145 | sc.getContent().edit(mapping=d) |
---|
146 | # |
---|
147 | # Level |
---|
148 | # |
---|
149 | l = getattr(sc,level,None) |
---|
150 | if l is None: |
---|
151 | #self.log('Creating Department %(DeptCode)s = %(Description)s' % dep) |
---|
152 | logger.info('Creating Level %(StudentLevel)s for %(fullname)s' % student) |
---|
153 | sc.invokeFactory('StudyLevel', level) |
---|
154 | l = getattr(sc, level) |
---|
155 | certificate = certs[certcode] |
---|
156 | cert_level = getattr(certificate,level,None) |
---|
157 | if cert_level is None: |
---|
158 | logger.info('Level %(level)s not in %(certcode)s' % vars()) |
---|
159 | l.getContent().edit(mapping={'Title': "Level %s" % level}) |
---|
160 | l.invokeFactory('Semester','first') |
---|
161 | l.invokeFactory('Semester','second') |
---|
162 | first_s = getattr(l,'first') |
---|
163 | first_s.getContent().edit(mapping={'Title': 'First Semester'}) |
---|
164 | second_s = getattr(l,'second') |
---|
165 | second_s.getContent().edit(mapping={'Title': 'Second Semester'}) |
---|
166 | else: |
---|
167 | em = 'Student with ID %(MatricNo)s %(fullname)s already exists\n' % student |
---|
168 | logger.info(em) |
---|
169 | no_import.write(em) |
---|
170 | 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) |
---|
171 | if tr_count > MAX_TRANS: |
---|
172 | transaction.commit() |
---|
173 | em = 'Transaction commited\n' % student |
---|
174 | logger.info(em) |
---|
175 | tr_count = 0 |
---|
176 | tr_count += 1 |
---|
177 | return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) |
---|
178 | return self.students.academics_contents() |
---|
179 | ###) |
---|
180 | |
---|
181 | security.declareProtected(ModifyPortalContent,"loadFullTimeStudentsResultsFromCSV") ###( |
---|
182 | def loadFullTimeStudentsResultsFromCSV(self): |
---|
183 | """load Fulltime Studentdata from CSV values""" |
---|
184 | #return |
---|
185 | import transaction |
---|
186 | tr_count = 0 |
---|
187 | name = 'short_full_time_results_2004_2005' |
---|
188 | no_import = False |
---|
189 | if not no_import: |
---|
190 | no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w") |
---|
191 | no_import.write('"Matnumber","CosCode","Ansbook","CosStuatus","Session","Mat_Cos","Score","CarryLevel","Grade","Weight","Semster","Verdict","Level","id","GPA"\n') |
---|
192 | logger = logging.getLogger('%s_import' % name) |
---|
193 | logger.info('Start loading from %s.csv' % name) |
---|
194 | students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject() |
---|
195 | try: |
---|
196 | results = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) |
---|
197 | except: |
---|
198 | logger.error('Error reading %s.csv' % name) |
---|
199 | return |
---|
200 | l = self.portal_catalog({'meta_type': "Student"}) |
---|
201 | students = {} |
---|
202 | for s in l: |
---|
203 | students[s.id] = s.getObject() |
---|
204 | l = self.portal_catalog({'meta_type': "Course"}) |
---|
205 | courses = {} |
---|
206 | for c in l: |
---|
207 | courses[c.id] = c.getObject() |
---|
208 | for result in results: |
---|
209 | sid = result.get('Matnumber') |
---|
210 | if sid not in students.keys(): |
---|
211 | em = 'Student with ID %(Matnumber)s not found\n' % result |
---|
212 | logger.info(em) |
---|
213 | no_import.write(em) |
---|
214 | 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' % result) |
---|
215 | continue |
---|
216 | course = result.get('CosCode') |
---|
217 | if course not in courses.keys(): |
---|
218 | em = 'Course with ID %(CosCode)s not found\n' % result |
---|
219 | logger.info(em) |
---|
220 | no_import.write(em) |
---|
221 | 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' % result) |
---|
222 | continue |
---|
223 | level = result.get('Level') |
---|
224 | try: |
---|
225 | int(level) |
---|
226 | except: |
---|
227 | em = 'Result for result with ID %(Matnumber)s Course %(CosCode)s Level is empty\n' % result |
---|
228 | logger.info(em) |
---|
229 | no_import.write(em) |
---|
230 | 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' % result) |
---|
231 | continue |
---|
232 | sf = students.get(sid) |
---|
233 | sc = getattr(sf,'study_course') |
---|
234 | l = getattr(sc,level,None) |
---|
235 | if l is None: |
---|
236 | #self.log('Creating Department %(DeptCode)s = %(Description)s' % dep) |
---|
237 | logger.info('Creating Level %(Level)s for %(Matnumber)s' % result) |
---|
238 | sc.invokeFactory('StudyLevel', level) |
---|
239 | l = getattr(sc, level) |
---|
240 | l.getContent().edit(mapping={'Title': "Level %s" % level}) |
---|
241 | l.invokeFactory('Semester','first') |
---|
242 | l.invokeFactory('Semester','second') |
---|
243 | first_s = getattr(l,'first') |
---|
244 | first_s.getContent().edit(mapping={'Title': 'First Semester'}) |
---|
245 | second_s = getattr(l,'second') |
---|
246 | second_s.getContent().edit(mapping={'Title': 'Second Semester'}) |
---|
247 | snr = result.get('Semester') |
---|
248 | semester = getattr(l,'first') |
---|
249 | if snr == "2": |
---|
250 | semester = getattr(l,'second') |
---|
251 | logger.info('Creating CourseTicket %(CourseTicket)s in Level %(Level)s for %(Matnumber)s' % result) |
---|
252 | semester.invokeFactory('CourseTicket',course) |
---|
253 | ct = getattr(semester,course) |
---|
254 | d = {} |
---|
255 | d['ansbook'] = result.get('Ansbook') |
---|
256 | d['status'] = result.get('CosStuatus') |
---|
257 | d['score'] = result.get('Score') |
---|
258 | d['carry_level'] = result.get('CarryLevel') |
---|
259 | d['grade'] = result.get('Grade') |
---|
260 | d['weight'] = result.get('Weight') |
---|
261 | d['verdict'] = result.get('Verdict') |
---|
262 | d['import_id'] = result.get('id') |
---|
263 | gpa = result.get('GPA').replace(',','.') |
---|
264 | d['gpa'] = float(gpa) |
---|
265 | ct.getContent().edit(mapping = d) |
---|
266 | if tr_count > MAX_TRANS: |
---|
267 | transaction.commit() |
---|
268 | tr_count = 0 |
---|
269 | tr_count += 1 |
---|
270 | return self.students.academics_contents() |
---|
271 | |
---|
272 | ###) |
---|
273 | |
---|
274 | |
---|
275 | security.declareProtected(View,"Title") |
---|
276 | def Title(self): |
---|
277 | """compose title""" |
---|
278 | return "Student Section" |
---|
279 | |
---|
280 | InitializeClass(StudentsFolder) |
---|
281 | |
---|
282 | def addStudentsFolder(container, id, REQUEST=None, **kw): |
---|
283 | """Add a Student.""" |
---|
284 | ob = StudentsFolder(id, **kw) |
---|
285 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
286 | ###) |
---|
287 | |
---|
288 | class Student(CPSDocument): ###( |
---|
289 | """ |
---|
290 | WAeUP Student container for the various student data |
---|
291 | """ |
---|
292 | meta_type = 'Student' |
---|
293 | portal_type = meta_type |
---|
294 | security = ClassSecurityInfo() |
---|
295 | |
---|
296 | security.declareProtected(View,"Title") |
---|
297 | def Title(self): |
---|
298 | """compose title""" |
---|
299 | reg_nr = self.getId()[1:] |
---|
300 | data = getattr(self,'personal',None) |
---|
301 | if data: |
---|
302 | content = data.getContent() |
---|
303 | return "%s %s" % (content.firstname,content.lastname) |
---|
304 | return self.title |
---|
305 | |
---|
306 | |
---|
307 | InitializeClass(Student) |
---|
308 | |
---|
309 | def addStudent(container, id, REQUEST=None, **kw): |
---|
310 | """Add a Student.""" |
---|
311 | ob = Student(id, **kw) |
---|
312 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
313 | |
---|
314 | ###) |
---|
315 | |
---|
316 | class StudentPersonal(CPSDocument): ###( |
---|
317 | """ |
---|
318 | WAeUP Student container for the various student data |
---|
319 | """ |
---|
320 | meta_type = 'StudentPersonal' |
---|
321 | portal_type = meta_type |
---|
322 | security = ClassSecurityInfo() |
---|
323 | |
---|
324 | security.declareProtected(View,"Title") |
---|
325 | def Title(self): |
---|
326 | """compose title""" |
---|
327 | content = self.getContent() |
---|
328 | #return "Personal Data for %s %s" % (content.firstname,content.lastname) |
---|
329 | return "Personal Data" |
---|
330 | |
---|
331 | |
---|
332 | InitializeClass(StudentPersonal) |
---|
333 | |
---|
334 | def addStudentPersonal(container, id, REQUEST=None, **kw): |
---|
335 | """Add a Students personal data.""" |
---|
336 | ob = StudentPersonal(id, **kw) |
---|
337 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
338 | |
---|
339 | ###) |
---|
340 | |
---|
341 | class StudentClearance(CPSDocument): ###( |
---|
342 | """ |
---|
343 | WAeUP Student container for the various student data |
---|
344 | """ |
---|
345 | meta_type = 'StudentClearance' |
---|
346 | portal_type = meta_type |
---|
347 | security = ClassSecurityInfo() |
---|
348 | |
---|
349 | security.declareProtected(View,"Title") |
---|
350 | def Title(self): |
---|
351 | """compose title""" |
---|
352 | content = self.getContent() |
---|
353 | #return "Clearance Data for %s %s" % (content.firstname,content.lastname) |
---|
354 | return "Clearance Data" |
---|
355 | |
---|
356 | |
---|
357 | InitializeClass(StudentClearance) |
---|
358 | |
---|
359 | def addStudentClearance(container, id, REQUEST=None, **kw): |
---|
360 | """Add a Students personal data.""" |
---|
361 | ob = StudentClearance(id, **kw) |
---|
362 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
363 | |
---|
364 | ###) |
---|
365 | |
---|
366 | class StudentStudyCourse(CPSDocument): ###( |
---|
367 | """ |
---|
368 | WAeUP Student container for the various student data |
---|
369 | """ |
---|
370 | meta_type = 'StudentStudyCourse' |
---|
371 | portal_type = meta_type |
---|
372 | security = ClassSecurityInfo() |
---|
373 | |
---|
374 | security.declareProtected(View,"Title") |
---|
375 | def Title(self): |
---|
376 | """compose title""" |
---|
377 | content = self.getContent() |
---|
378 | return "Course Major" |
---|
379 | |
---|
380 | |
---|
381 | InitializeClass(StudentStudyCourse) |
---|
382 | |
---|
383 | def addStudentStudyCourse(container, id, REQUEST=None, **kw): |
---|
384 | """Add a Students personal data.""" |
---|
385 | ob = StudentStudyCourse(id, **kw) |
---|
386 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
387 | |
---|
388 | ###) |
---|
389 | |
---|
390 | class StudentAdmission(CPSDocument): ###( |
---|
391 | """ |
---|
392 | WAeUP Student container for the various student data |
---|
393 | """ |
---|
394 | meta_type = 'StudentAdmission' |
---|
395 | portal_type = meta_type |
---|
396 | security = ClassSecurityInfo() |
---|
397 | |
---|
398 | security.declareProtected(View,"Title") |
---|
399 | def Title(self): |
---|
400 | """compose title""" |
---|
401 | return "Admission Data" |
---|
402 | |
---|
403 | |
---|
404 | InitializeClass(StudentAdmission) |
---|
405 | |
---|
406 | def addStudentAdmission(container, id, REQUEST=None, **kw): |
---|
407 | """Add a Students eligibility data.""" |
---|
408 | ob = StudentAdmission(id, **kw) |
---|
409 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
410 | |
---|
411 | ###) |
---|
412 | |
---|
413 | class StudyLevel(CPSDocument): ###( |
---|
414 | """ |
---|
415 | WAeUP StudyLevel containing the courses and students |
---|
416 | """ |
---|
417 | meta_type = 'StudyLevel' |
---|
418 | portal_type = meta_type |
---|
419 | security = ClassSecurityInfo() |
---|
420 | |
---|
421 | security.declareProtected(View,"Title") |
---|
422 | def Title(self): |
---|
423 | """compose title""" |
---|
424 | return "Level %s" % self.aq_parent.getId() |
---|
425 | |
---|
426 | |
---|
427 | InitializeClass(StudyLevel) |
---|
428 | |
---|
429 | def addStudyLevel(container, id, REQUEST=None, **kw): |
---|
430 | """Add a StudyLevel.""" |
---|
431 | ob = StudyLevel(id, **kw) |
---|
432 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
433 | |
---|
434 | ###) |
---|
435 | |
---|
436 | class Semester(CPSDocument): ###( |
---|
437 | """ |
---|
438 | WAeUP Semester containing the courses and students |
---|
439 | """ |
---|
440 | meta_type = 'Semester' |
---|
441 | portal_type = meta_type |
---|
442 | security = ClassSecurityInfo() |
---|
443 | |
---|
444 | InitializeClass(Semester) |
---|
445 | |
---|
446 | def addSemester(container, id, REQUEST=None, **kw): |
---|
447 | """Add a Semester.""" |
---|
448 | ob = Semester(id, **kw) |
---|
449 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
450 | |
---|
451 | ###) |
---|
452 | |
---|
453 | class ScratchCardBatchesFolder(CPSDocument): ###( |
---|
454 | """ |
---|
455 | WAeUP Student container for the various student data |
---|
456 | """ |
---|
457 | meta_type = 'ScratchCardBatchesFolder' |
---|
458 | portal_type = meta_type |
---|
459 | security = ClassSecurityInfo() |
---|
460 | |
---|
461 | security.declareProtected(View,"Title") |
---|
462 | def Title(self): |
---|
463 | """compose title""" |
---|
464 | return "Pin Batches" |
---|
465 | |
---|
466 | |
---|
467 | InitializeClass(ScratchCardBatchesFolder) |
---|
468 | |
---|
469 | def addScratchCardBatchesFolder(container, id, REQUEST=None, **kw): |
---|
470 | """Add a Students personal data.""" |
---|
471 | ob = ScratchCardBatchesFolder(id, **kw) |
---|
472 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
473 | |
---|
474 | ###) |
---|
475 | |
---|
476 | from Products.WAeUP_SRP.WAeUPTables import PinTable |
---|
477 | |
---|
478 | class ScratchCardBatch(CPSDocument): ###( |
---|
479 | """ |
---|
480 | WAeUP Student container for the various student data |
---|
481 | """ |
---|
482 | meta_type = 'ScratchCardBatch' |
---|
483 | portal_type = meta_type |
---|
484 | security = ClassSecurityInfo() |
---|
485 | |
---|
486 | security.declareProtected(View,"Title") |
---|
487 | def Title(self): |
---|
488 | """compose title""" |
---|
489 | doc = self.getContent() |
---|
490 | return "Pin Batch %s BatchNo %d" % (doc.prefix, doc.batch_no) |
---|
491 | |
---|
492 | |
---|
493 | InitializeClass(ScratchCardBatch) |
---|
494 | |
---|
495 | def addScratchCardBatch(container, id, REQUEST=None, **kw): |
---|
496 | """Add a Students personal data.""" |
---|
497 | ob = ScratchCardBatch(id, **kw) |
---|
498 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
499 | |
---|
500 | ###) |
---|