source: main/waeup.sirp/branches/henrik-bootstrap/src/waeup/sirp/students/payments.py @ 11102

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

pyflakes

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