source: main/waeup.uniben/trunk/src/waeup/uniben/students/student.py @ 17388

Last change on this file since 17388 was 16824, checked in by Henrik Bettermann, 3 years ago

Add missing import.

  • Property svn:keywords set to Id
File size: 2.7 KB
RevLine 
[7505]1## $Id: student.py 16824 2022-02-21 18:30:15Z 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"""
19Container for the various objects owned by students.
20"""
21import grok
22from zope.interface import implementedBy
[16824]23from waeup.kofa.interfaces import (
24    CLEARANCE, REQUESTED, GRADUATED, TRANSREL, TRANSVAL)
[7822]25from waeup.kofa.utils.helpers import attrs_to_fields
[8988]26from waeup.kofa.students.student import StudentFactory
[8865]27from waeup.kofa.students.interfaces import IStudentNavigation
[10488]28from waeup.kofa.utils.helpers import get_current_principal
[8988]29from kofacustom.nigeria.students.student import NigeriaStudent
[13085]30from waeup.uniben.students.interfaces import (
[16382]31    ICustomStudent, ICustomStudentPersonalEdit, IMedicalHistory)
[7505]32
33
[8988]34class CustomStudent(NigeriaStudent):
[7505]35    """This is a student container for the various objects
36    owned by students.
37    """
[13085]38    grok.implements(
[16382]39        ICustomStudent, IStudentNavigation, ICustomStudentPersonalEdit,
40        IMedicalHistory)
[8204]41    grok.provides(ICustomStudent)
[7505]42
[10312]43    @property
44    def transcript_enabled(self):
[15172]45        return True
46        #user = get_current_principal()
47        #if user.id in ('admin', 'isouaba', 'med', 'zope.mgr'):
48        #    return True
49        #return False
[7505]50
[14902]51    @property
52    def is_jupeb(self):
[16337]53        if self.current_mode == 'found':
[14902]54            return True
[16371]55        return
[10312]56
[16371]57    @property
58    def clearance_locked(self):
[16688]59        return self.state not in (CLEARANCE, )
[14902]60
[16823]61    @property
62    def studycourse_locked(self):
63        # return self.state in (GRADUATED, TRANSREL, TRANSVAL)
64        return self.state in (TRANSREL, TRANSVAL)
[16371]65
[16823]66
[7505]67# Set all attributes of Student required in IStudent as field
68# properties. Doing this, we do not have to set initial attributes
69# ourselves and as a bonus we get free validation when an attribute is
70# set.
[8204]71CustomStudent = attrs_to_fields(CustomStudent)
[7603]72
[8204]73class CustomStudentFactory(StudentFactory):
[7603]74    """A factory for students.
75    """
76
77    def __call__(self, *args, **kw):
[8204]78        return CustomStudent()
[7603]79
80    def getInterfaces(self):
[8204]81        return implementedBy(CustomStudent)
Note: See TracBrowser for help on using the repository browser.