source: main/waeup.sirp/trunk/src/waeup/sirp/students/container.py @ 6636

Last change on this file since 6636 was 6635, checked in by Henrik Bettermann, 14 years ago

Make action buttons smaller on studentpage.

Add StudentAccommodation? container class which contains the accommodation objects.

Add StudentPayments? container class which contains the payments objects.

  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
2## This program is free software; you can redistribute it and/or modify
3## it under the terms of the GNU General Public License as published by
4## the Free Software Foundation; either version 2 of the License, or
5## (at your option) any later version.
6##
7## This program is distributed in the hope that it will be useful,
8## but WITHOUT ANY WARRANTY; without even the implied warranty of
9## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10## GNU General Public License for more details.
11##
12## You should have received a copy of the GNU General Public License
13## along with this program; if not, write to the Free Software
14## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15##
16"""
17Containers for students.
18"""
19import grok
20import os
21from zope.component.interfaces import IFactory
22from zope.interface import implementedBy
23from waeup.sirp.students.interfaces import (
24    IStudentsContainer, IStudent, IStudentPayments, IStudentAccommodation)
25from waeup.sirp.students.studycourse import StudentStudyCourse
26from waeup.sirp.students.payments import StudentPayments
27from waeup.sirp.students.accommodation import StudentAccommodation
28
29class StudentsContainer(grok.Container):
30    """
31    The node containing the student models
32    """
33
34    grok.implements(IStudentsContainer)
35
36    def archive(self, id=None):
37        raise NotImplementedError()
38
39    def clear(self, id=None, archive=True):
40        raise NotImplementedError()
41
42    def addStudent(self, student):
43        """Add a student with subcontainers.
44        """
45        if not IStudent.providedBy(student):
46            raise TypeError('StudentsContainers contain only IStudent instances')
47        self[student.student_id] = student
48        studycourse = StudentStudyCourse()
49        self[student.student_id]['studycourse'] = studycourse
50        payments = StudentPayments()
51        self[student.student_id]['payments'] = payments
52        accommodation = StudentAccommodation()
53        self[student.student_id]['accommodation'] = accommodation
54        return
Note: See TracBrowser for help on using the repository browser.