source: main/waeup.sirp/branches/ulif-fasttables/src/waeup/sirp/jambtables/applicants.py @ 10571

Last change on this file since 10571 was 5318, checked in by uli, 14 years ago

Add a factory for applicants.

File size: 4.4 KB
Line 
1##
2## applicants.py
3## Login : <uli@pu.smp.net>
4## Started on  Fri Jul 16 11:46:55 2010 Uli Fouquet
5## $Id$
6##
7## Copyright (C) 2010 Uli Fouquet
8## This program is free software; you can redistribute it and/or modify
9## it under the terms of the GNU General Public License as published by
10## the Free Software Foundation; either version 2 of the License, or
11## (at your option) any later version.
12##
13## This program is distributed in the hope that it will be useful,
14## but WITHOUT ANY WARRANTY; without even the implied warranty of
15## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16## GNU General Public License for more details.
17##
18## You should have received a copy of the GNU General Public License
19## along with this program; if not, write to the Free Software
20## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21##
22import grok
23from zope.component.interfaces import IFactory
24from zope.schema.fieldproperty import FieldProperty
25from waeup.sirp.interfaces import IWAeUPSIRPPluggable
26from waeup.sirp.jambtables.interfaces import (
27    IResultEntry, IApplicant, IApplicantContainer
28    )
29
30class ResultEntry(grok.Context):
31    grok.implements(IResultEntry)
32
33    def __init__(self, subject=None, score=None):
34        self.subject = subject
35        self.score = score
36   
37
38class Applicant(grok.Context):
39    grok.implements(IApplicant)
40
41    fst_sit_results = FieldProperty(IApplicant['fst_sit_results'])
42   
43    def __init__(self):
44        self.reg_no = None
45        self.access_code = None
46        self.serial = None
47        self.course1 = None
48        self.course2 = None
49        self.course3 = None
50        self.firstname = None
51        self.middlenames = None
52        self.lastname = None
53        self.jamb_age = None
54        self.date_of_birth = None
55        self.jamb_state = None
56        self.jamb_lga = None
57        self.lga = None
58        self.sex = None
59        self.email = None
60        self.phone = None
61        self.passport = False
62        self.aos = None
63        self.subj1 = None
64        self.subj2 = None
65        self.subj3 = None
66        self.hq_matric_no = None
67        self.hq_type = None
68        self.hq_grade = None
69        self.hq_school = None
70        self.hq_session = None
71        self.hq_disc = None
72        self.fst_sit_fname = None
73        self.fst_sit_no = None
74        self.fst_sit_date = None
75        self.fst_sit_type = None
76        #self.fst_sit_results = []
77        self.fst_sit_results = None
78        #self.fst_sit_results = ResultEntry()
79        self.scd_sit_fname = None
80        self.scd_sit_no = None
81        self.scd_sit_date = None
82        self.scd_sit_type = None
83        self.scd_sit_results = None
84        self.eng_score = None
85        self.subj1score = None
86        self.subj2score = None
87        self.subj3score = None
88        self.application_date = None
89        self.status = None
90        self.screening_date = None
91        self.screening_type = None
92        self.screening_score = None
93        self.screening_venue = None
94        self.total_score = None
95        self.course_admitted = None
96        self.department = None
97        self.faculty = None
98        self.entry_session = None
99        self.notice = None
100        self.student_id = None
101        self.import_record_no = None
102        self.imported_by = None
103        self.import_date = None
104        self.import_from = None
105
106class ApplicantFactory(grok.GlobalUtility):
107    """A factory for faculty containers.
108    """
109    grok.implements(IFactory)
110    grok.name(u'waeup.Applicant')
111    title = u"Create a new applicant.",
112    description = u"This factory instantiates new applicant instances."
113
114    def __call__(self, *args, **kw):
115        return Applicant()
116
117    def getInterfaces(self):
118        return implementedBy(Appliant)
119
120       
121class ApplicantContainer(grok.Container):
122    grok.implements(IApplicantContainer)
123
124class AccessCodePlugin(grok.GlobalUtility):
125    grok.name('applications')
126    grok.implements(IWAeUPSIRPPluggable)
127
128    def setup(self, site, name, logger):
129        site['applications'] = ApplicantContainer()
130        logger.info('Installed application container.')
131        return
132
133    def update(self, site, name, logger):
134        if not 'applications' in site.keys():
135            logger.info('Updating site at %s. Installing applications.' % (
136                    site,))
137            self.setup(site, name, logger)
138        else:
139            logger.info(
140                'ApplicantsPlugin: Updating site at %s: Nothing to do.' % (
141                    site, ))
142        return
143
Note: See TracBrowser for help on using the repository browser.