source: main/waeup.sirp/branches/ulif-experimental-folders/src/waeup/sirp/student/student.py @ 10009

Last change on this file since 10009 was 4920, checked in by uli, 15 years ago

Make unit tests run again with the new package layout.

  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
1import grok
2from grok import index
3from waeup.sirp.student.interfaces import IStudent
4
5def fromCsv(a):
6    #Factory method
7    student = Student("Dummy")
8    student.entry_mode, student.end_level, student.name, student.jamb_reg_no, student.level, student.id, student.lga, student.entry_session, student.matric_no, student.sex, student.phone, student.session, student.course, student.mode, student.faculty, student.department, student.verdict, student.review_state,  student.perm_address, student.email = a
9    return student
10
11class Student(grok.Model):
12    """This is a student record.
13    """
14    grok.implements(IStudent)
15
16    #TODO: REFACTOR TO SCHEMA
17    fields = [   "entry_mode",
18                 "end_level",
19                 "name",
20                 "jamb_reg_no",
21                 "level",
22                 "id",
23                 "lga",
24                 "entry_session",
25                 "matric_no",
26                 "sex",
27                 "phone",
28                 "session",
29                 "course",
30                 "mode",
31                 "faculty",
32                 "department",
33                 "verdict",
34                 "review_state",
35                 "perm_address",
36                 "email"
37            ]
38
39    def __init__(self, name=None):
40        """
41        TODO: REFACTOR TO IMPORT METHOD
42        Fields:
43                 entry_mode,
44                 end_level,
45                 name,
46                 jamb_reg_no,
47                 level,
48                 id,
49                 lga,
50                 entry_session,
51                 matric_no,
52                 sex,
53                 phone,
54                 session,
55                 course,
56                 mode,
57                 faculty,
58                 department,
59                 verdict,
60                 review_state,
61                 perm_address,
62                 email
63
64        """
65        self.name = name
66       
67
68    def getCsv(self):
69        #return self.entry_mode, self.end_level, self.name, self.jamb_reg_no, self.level, self.id, self.lga, self.entry_session, self.matric_no, self.sex, self.phone, self.session, self.course, self.mode, self.faculty, self.department, self.verdict, self.review_state,  self.perm_address, self.email
70        return [getattr(self, field, u"") for field in self.fields]
71
72
73grok.global_utility(Student, provides=IStudent)
Note: See TracBrowser for help on using the repository browser.