source: main/kofacustom.ekodisco/trunk/src/kofacustom/ekodisco/applicants/applicant.py @ 10814

Last change on this file since 10814 was 10814, checked in by Henrik Bettermann, 11 years ago

Omit sex.

  • Property svn:keywords set to Id
File size: 2.3 KB
Line 
1## $Id: applicant.py 10814 2013-11-29 10:06:18Z 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
19import grok
20from zope.interface import implementedBy
21from waeup.kofa.applicants.applicant import ApplicantFactory
22from waeup.kofa.utils.helpers import attrs_to_fields
23from waeup.kofa.applicants.applicant import Applicant
24from kofacustom.ekodisco.applicants.interfaces import(
25    ICustomApplicant, ICustomApplicantEdit)
26
27class CustomApplicant(Applicant):
28
29    grok.implements(ICustomApplicant, ICustomApplicantEdit)
30    grok.provides(ICustomApplicant)
31
32    create_names = [
33        'firstname', 'middlename', 'lastname',
34        'date_of_birth',
35        'email', 'phone', 'perm_address'
36        ]
37
38    def _setStudyCourseAttributes(self, studycourse):
39        #studycourse.entry_mode = self.course_admitted.study_mode
40        #studycourse.current_level = self.course_admitted.start_level
41        studycourse.service_address = self.service_address
42        studycourse.certificate = self.course_admitted
43        studycourse.entry_session = self.__parent__.year
44        studycourse.current_session = self.__parent__.year
45        return
46
47# Set all attributes of CustomApplicant required in ICustomApplicant as field
48# properties. Doing this, we do not have to set initial attributes
49# ourselves and as a bonus we get free validation when an attribute is
50# set.
51CustomApplicant = attrs_to_fields(CustomApplicant)
52
53class CustomApplicantFactory(ApplicantFactory):
54    """A factory for customized applicants.
55    """
56
57    def __call__(self, *args, **kw):
58        return CustomApplicant()
59
60    def getInterfaces(self):
61        return implementedBy(CustomApplicant)
Note: See TracBrowser for help on using the repository browser.