source: main/waeup.sirp/trunk/src/waeup/sirp/applicants/applicants.py @ 5757

Last change on this file since 5757 was 5753, checked in by uli, 14 years ago

Move main applicant interfaces to applicants package and try to fix first imports.

File size: 4.5 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.applicants.interfaces import (
28    IResultEntry, IApplicant, IApplicantPDEEditData
29    )
30from waeup.sirp.widgets.passportwidget import PassportImage
31
32class ResultEntry(grok.Context):
33    grok.implements(IResultEntry)
34
35    def __init__(self, subject=None, score=None):
36        self.subject = subject
37        self.score = score
38   
39class Applicant(grok.Context):
40    # class Applicant(grok.Model):
41    grok.implements(IApplicant, IApplicantPDEEditData)
42    grok.provides(IApplicant)
43
44    fst_sit_results = FieldProperty(IApplicant['fst_sit_results'])
45   
46    def __init__(self):
47        self.reg_no = None
48        self.access_code = None
49        self.serial = None
50        self.course1 = None
51        self.course2 = None
52        self.course3 = None
53        self.firstname = None
54        self.middlenames = None
55        self.lastname = None
56        self.jamb_age = None
57        self.date_of_birth = None
58        self.jamb_state = None
59        self.jamb_lga = None
60        self.lga = None
61        self.sex = None
62        self.email = None
63        self.phone = None
64        self.passport = False
65        self.aos = None
66        self.subj1 = None
67        self.subj2 = None
68        self.subj3 = None
69        self.hq_matric_no = None
70        self.hq_type = None
71        self.hq_grade = None
72        self.hq_school = None
73        self.hq_session = None
74        self.hq_disc = None
75        self.fst_sit_fname = None
76        self.fst_sit_no = None
77        self.fst_sit_date = None
78        self.fst_sit_type = None
79        #self.fst_sit_results = []
80        self.fst_sit_results = None
81        #self.fst_sit_results = ResultEntry()
82        self.scd_sit_fname = None
83        self.scd_sit_no = None
84        self.scd_sit_date = None
85        self.scd_sit_type = None
86        self.scd_sit_results = None
87        self.eng_score = None
88        self.subj1score = None
89        self.subj2score = None
90        self.subj3score = None
91        self.application_date = None
92        self.status = None
93        self.screening_date = None
94        self.screening_type = None
95        self.screening_score = None
96        self.screening_venue = None
97        self.total_score = None
98        self.course_admitted = None
99        self.department = None
100        self.faculty = None
101        self.entry_session = None
102        self.notice = None
103        self.student_id = None
104        self.import_record_no = None
105        self.imported_by = None
106        self.import_date = None
107        self.import_from = None
108
109class ApplicantTraverser(grok.Traverser):
110    grok.context(IApplicant)
111    def traverse(self, name):
112        #passport_filename = self.context.passport.filename
113        passport_filename = getattr(self.context.passport, 'filename', None)
114        print "FILENAME: ", passport_filename
115        if name == passport_filename:
116            print "USE FILE", self.context.passport
117            return self.context.passport
118        if name == 'passport.jpg':
119            if self.context.passport is not None:
120                print "PP: ", self.context.passport
121                return self.context.passport
122            return PassportImage(None)
123
124class ApplicantFactory(grok.GlobalUtility):
125    """A factory for faculty containers.
126    """
127    grok.implements(IFactory)
128    grok.name(u'waeup.Applicant')
129    title = u"Create a new applicant.",
130    description = u"This factory instantiates new applicant instances."
131
132    def __call__(self, *args, **kw):
133        return Applicant()
134
135    def getInterfaces(self):
136        return implementedBy(Applicant)
Note: See TracBrowser for help on using the repository browser.