source: main/waeup.sirp/branches/ulif-paster/src/waeup/sirp/jambtables/applicants.py @ 10009

Last change on this file since 10009 was 5483, checked in by uli, 14 years ago

Declare that Applicant objects also implement the new interface.

File size: 4.6 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.interface import implementedBy
25from zope.schema.fieldproperty import FieldProperty
26from waeup.sirp.interfaces import IWAeUPSIRPPluggable
27from waeup.sirp.jambtables.interfaces import (
28    IResultEntry, IApplicant, IApplicantContainer, IApplicantPDEEditData
29    )
30
31class ResultEntry(grok.Context):
32    grok.implements(IResultEntry)
33
34    def __init__(self, subject=None, score=None):
35        self.subject = subject
36        self.score = score
37   
38class Applicant(grok.Context):
39    grok.implements(IApplicant, IApplicantPDEEditData)
40    grok.provides(IApplicant)
41
42    fst_sit_results = FieldProperty(IApplicant['fst_sit_results'])
43   
44    def __init__(self):
45        self.reg_no = None
46        self.access_code = None
47        self.serial = None
48        self.course1 = None
49        self.course2 = None
50        self.course3 = None
51        self.firstname = None
52        self.middlenames = None
53        self.lastname = None
54        self.jamb_age = None
55        self.date_of_birth = None
56        self.jamb_state = None
57        self.jamb_lga = None
58        self.lga = None
59        self.sex = None
60        self.email = None
61        self.phone = None
62        self.passport = False
63        self.aos = None
64        self.subj1 = None
65        self.subj2 = None
66        self.subj3 = None
67        self.hq_matric_no = None
68        self.hq_type = None
69        self.hq_grade = None
70        self.hq_school = None
71        self.hq_session = None
72        self.hq_disc = None
73        self.fst_sit_fname = None
74        self.fst_sit_no = None
75        self.fst_sit_date = None
76        self.fst_sit_type = None
77        #self.fst_sit_results = []
78        self.fst_sit_results = None
79        #self.fst_sit_results = ResultEntry()
80        self.scd_sit_fname = None
81        self.scd_sit_no = None
82        self.scd_sit_date = None
83        self.scd_sit_type = None
84        self.scd_sit_results = None
85        self.eng_score = None
86        self.subj1score = None
87        self.subj2score = None
88        self.subj3score = None
89        self.application_date = None
90        self.status = None
91        self.screening_date = None
92        self.screening_type = None
93        self.screening_score = None
94        self.screening_venue = None
95        self.total_score = None
96        self.course_admitted = None
97        self.department = None
98        self.faculty = None
99        self.entry_session = None
100        self.notice = None
101        self.student_id = None
102        self.import_record_no = None
103        self.imported_by = None
104        self.import_date = None
105        self.import_from = None
106
107class ApplicantFactory(grok.GlobalUtility):
108    """A factory for faculty containers.
109    """
110    grok.implements(IFactory)
111    grok.name(u'waeup.Applicant')
112    title = u"Create a new applicant.",
113    description = u"This factory instantiates new applicant instances."
114
115    def __call__(self, *args, **kw):
116        return Applicant()
117
118    def getInterfaces(self):
119        return implementedBy(Applicant)
120
121       
122class ApplicantContainer(grok.Container):
123    grok.implements(IApplicantContainer)
124
125class ApplicantsPlugin(grok.GlobalUtility):
126    """A WAeUPSIRPPlugin that creates an applications folder in portal.
127    """
128    grok.name('applications')
129    grok.implements(IWAeUPSIRPPluggable)
130
131    def setup(self, site, name, logger):
132        site['applications'] = ApplicantContainer()
133        logger.info('Installed application container.')
134        return
135
136    def update(self, site, name, logger):
137        if not 'applications' in site.keys():
138            logger.info('Updating site at %s. Installing applications.' % (
139                    site,))
140            self.setup(site, name, logger)
141        else:
142            logger.info(
143                'ApplicantsPlugin: Updating site at %s: Nothing to do.' % (
144                    site, ))
145        return
Note: See TracBrowser for help on using the repository browser.