import grok from grok import index from waeup.student.interfaces import IStudent def fromCsv(a): #Factory method student = Student("Dummy") 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 return student class Student(grok.Model): """This is a student record. """ grok.implements(IStudent) #TODO: REFACTOR TO SCHEMA fields = [ "entry_mode", "end_level", "name", "jamb_reg_no", "level", "id", "lga", "entry_session", "matric_no", "sex", "phone", "session", "course", "mode", "faculty", "department", "verdict", "review_state", "perm_address", "email" ] def __init__(self, name=None): """ TODO: REFACTOR TO IMPORT METHOD Fields: entry_mode, end_level, name, jamb_reg_no, level, id, lga, entry_session, matric_no, sex, phone, session, course, mode, faculty, department, verdict, review_state, perm_address, email """ self.name = name def getCsv(self): #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 return [getattr(self, field, u"") for field in self.fields] grok.global_utility(Student, provides=IStudent)