source: main/waeup.sirp/trunk/src/waeup/sirp/students/payments.py @ 7243

Last change on this file since 7243 was 7191, checked in by Henrik Bettermann, 13 years ago

Adjust copyright statement and svn keyword in students.

  • Property svn:keywords set to Id
File size: 2.6 KB
Line 
1## $Id: payments.py 7191 2011-11-25 07:13:22Z 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 which contains the (student) payment objects.
20"""
21import grok
22from grok import index
23from zope.component.interfaces import IFactory
24from zope.interface import implementedBy
25from waeup.sirp.students.interfaces import (
26    IStudentPaymentsContainer, IStudentNavigation, IStudentOnlinePayment)
27from waeup.sirp.payments import PaymentsContainer, OnlinePayment
28from waeup.sirp.utils.helpers import attrs_to_fields
29
30class StudentPaymentsContainer(PaymentsContainer):
31    """This is a container for student payments.
32    """
33    grok.implements(IStudentPaymentsContainer, IStudentNavigation)
34    grok.provides(IStudentPaymentsContainer)
35
36    def __init__(self):
37        super(StudentPaymentsContainer, self).__init__()
38        return
39
40    def getStudent(self):
41        return self.__parent__
42
43StudentPaymentsContainer = attrs_to_fields(StudentPaymentsContainer)
44
45class StudentOnlinePayment(OnlinePayment):
46    """This is an online payment.
47    """
48    grok.implements(IStudentOnlinePayment, IStudentNavigation)
49    grok.provides(IStudentOnlinePayment)
50
51    def __init__(self):
52        super(StudentOnlinePayment, self).__init__()
53        p_id = None
54        return
55
56    def getStudent(self):
57        return self.__parent__.__parent__
58
59StudentOnlinePayment = attrs_to_fields(StudentOnlinePayment)
60
61# Student online payments must be importable. So we might need a factory.
62class StudentOnlinePaymentFactory(grok.GlobalUtility):
63    """A factory for student online payments.
64    """
65    grok.implements(IFactory)
66    grok.name(u'waeup.StudentOnlinePayment')
67    title = u"Create a new online payment.",
68    description = u"This factory instantiates new online payment instances."
69
70    def __call__(self, *args, **kw):
71        return StudentOnlinePayment()
72
73    def getInterfaces(self):
74        return implementedBy(StudentOnlinePayment)
Note: See TracBrowser for help on using the repository browser.