[8926] | 1 | ## $Id: applicant.py 14003 2016-07-02 04:56:31Z henrik $ |
---|
| 2 | ## |
---|
| 3 | ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann |
---|
| 4 | ## This program is free software; you can redistribute it and/or modify |
---|
| 5 | ## it under the terms of the GNU General Public License as published by |
---|
| 6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | ## (at your option) any later version. |
---|
| 8 | ## |
---|
| 9 | ## This program is distributed in the hope that it will be useful, |
---|
| 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | ## GNU General Public License for more details. |
---|
| 13 | ## |
---|
| 14 | ## You should have received a copy of the GNU General Public License |
---|
| 15 | ## along with this program; if not, write to the Free Software |
---|
| 16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 17 | ## |
---|
| 18 | |
---|
| 19 | import grok |
---|
| 20 | from zope.interface import implementedBy |
---|
| 21 | from waeup.kofa.applicants.applicant import Applicant, ApplicantFactory |
---|
| 22 | from waeup.kofa.utils.helpers import attrs_to_fields |
---|
| 23 | from kofacustom.nigeria.applicants.interfaces import( |
---|
| 24 | INigeriaApplicant, |
---|
| 25 | INigeriaUGApplicantEdit, INigeriaPGApplicantEdit, |
---|
[14003] | 26 | IPUTMEApplicantEdit, IBankAccount) |
---|
[8926] | 27 | |
---|
| 28 | class NigeriaApplicant(Applicant): |
---|
| 29 | |
---|
| 30 | grok.implements(INigeriaApplicant, INigeriaUGApplicantEdit, |
---|
[14003] | 31 | INigeriaPGApplicantEdit, IPUTMEApplicantEdit, IBankAccount) |
---|
[8926] | 32 | grok.provides(INigeriaApplicant) |
---|
| 33 | |
---|
[11616] | 34 | applicant_student_mapping = Applicant.applicant_student_mapping + [ |
---|
| 35 | ('lga', 'lga'), |
---|
| 36 | ('nationality', 'nationality'), |
---|
[13291] | 37 | ('fst_sit_fname', 'fst_sit_fname'), |
---|
| 38 | ('fst_sit_no', 'fst_sit_no'), |
---|
| 39 | ('fst_sit_date', 'fst_sit_date'), |
---|
| 40 | ('fst_sit_type', 'fst_sit_type'), |
---|
| 41 | ('fst_sit_results', 'fst_sit_results'), |
---|
| 42 | ('scd_sit_fname', 'scd_sit_fname'), |
---|
| 43 | ('scd_sit_no', 'scd_sit_no'), |
---|
| 44 | ('scd_sit_date', 'scd_sit_date'), |
---|
| 45 | ('scd_sit_type', 'scd_sit_type'), |
---|
| 46 | ('scd_sit_results', 'scd_sit_results'), |
---|
| 47 | ('hq_type', 'hq_type'), |
---|
| 48 | ('hq_fname', 'hq_fname'), |
---|
| 49 | ('hq_matric_no', 'hq_matric_no'), |
---|
| 50 | ('hq_degree', 'hq_degree'), |
---|
| 51 | ('hq_school', 'hq_school'), |
---|
| 52 | ('hq_session', 'hq_session'), |
---|
| 53 | ('hq_disc', 'hq_disc'), |
---|
[11616] | 54 | ] |
---|
[8926] | 55 | |
---|
[9482] | 56 | def _setStudyCourseAttributes(self, studycourse): |
---|
| 57 | if self.applicant_id.startswith('pude'): |
---|
| 58 | studycourse.entry_mode = u'de_ft' |
---|
| 59 | studycourse.current_level = 200 |
---|
| 60 | else: |
---|
| 61 | studycourse.entry_mode = self.course_admitted.study_mode |
---|
| 62 | studycourse.current_level = self.course_admitted.start_level |
---|
| 63 | studycourse.certificate = self.course_admitted |
---|
| 64 | studycourse.entry_session = self.__parent__.year |
---|
| 65 | studycourse.current_session = self.__parent__.year |
---|
| 66 | return |
---|
| 67 | |
---|
[9071] | 68 | # Set all attributes of NigeriaApplicant required in INigeriaApplicant as field |
---|
[8926] | 69 | # properties. Doing this, we do not have to set initial attributes |
---|
| 70 | # ourselves and as a bonus we get free validation when an attribute is |
---|
| 71 | # set. |
---|
| 72 | NigeriaApplicant = attrs_to_fields(NigeriaApplicant) |
---|
| 73 | |
---|
| 74 | class NigeriaApplicantFactory(ApplicantFactory): |
---|
| 75 | """A factory for customized applicants. |
---|
| 76 | """ |
---|
| 77 | |
---|
| 78 | def __call__(self, *args, **kw): |
---|
| 79 | return NigeriaApplicant() |
---|
| 80 | |
---|
| 81 | def getInterfaces(self): |
---|
| 82 | return implementedBy(NigeriaApplicant) |
---|