source: main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/studylevel.py @ 10222

Last change on this file since 10222 was 9695, checked in by Henrik Bettermann, 12 years ago

Use new attrs_to_fields function to display gpa and total_credits on level pages.

  • Property svn:keywords set to Id
File size: 2.7 KB
Line 
1## $Id: studylevel.py 9695 2012-11-20 06:37:56Z henrik $
2##
3## Copyright (C) 2012 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 which holds the data of a student study level
20and contains the course tickets.
21"""
22import grok
23from zope.component.interfaces import IFactory
24from zope.interface import implementedBy
25from waeup.kofa.utils.helpers import attrs_to_fields
26from waeup.kofa.students.studylevel import (
27    StudentStudyLevel, CourseTicket,
28    CourseTicketFactory, StudentStudyLevelFactory)
29from kofacustom.nigeria.students.interfaces import (
30    INigeriaStudentStudyLevel, IStudentNavigation, INigeriaCourseTicket)
31
32
33class NigeriaStudentStudyLevel(StudentStudyLevel):
34    """This is a container for course tickets.
35    """
36    grok.implements(INigeriaStudentStudyLevel, IStudentNavigation)
37    grok.provides(INigeriaStudentStudyLevel)
38
39NigeriaStudentStudyLevel = attrs_to_fields(
40    NigeriaStudentStudyLevel, omit=['total_credits', 'gpa'])
41
42class NigeriaStudentStudyLevelFactory(StudentStudyLevelFactory):
43    """A factory for student study levels.
44    """
45
46    def __call__(self, *args, **kw):
47        return NigeriaStudentStudyLevel()
48
49    def getInterfaces(self):
50        return implementedBy(NigeriaStudentStudyLevel)
51
52class NigeriaCourseTicket(CourseTicket):
53    """This is a course ticket which allows the
54    student to attend the course. Lecturers will enter scores and more at
55    the end of the term.
56
57    A course ticket contains a copy of the original course and
58    course referrer data. If the courses and/or their referrers are removed, the
59    corresponding tickets remain unchanged. So we do not need any event
60    triggered actions on course tickets.
61    """
62    grok.implements(INigeriaCourseTicket, IStudentNavigation)
63    grok.provides(INigeriaCourseTicket)
64
65NigeriaCourseTicket = attrs_to_fields(NigeriaCourseTicket)
66
67class NigeriaCourseTicketFactory(CourseTicketFactory):
68    """A factory for student study levels.
69    """
70
71    def __call__(self, *args, **kw):
72        return NigeriaCourseTicket()
73
74    def getInterfaces(self):
75        return implementedBy(NigeriaCourseTicket)
Note: See TracBrowser for help on using the repository browser.