source: main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/contracts.py @ 12578

Last change on this file since 12578 was 12571, checked in by Henrik Bettermann, 10 years ago

Add 'Registration in the Provisional Register' contract.

  • Property svn:keywords set to Id
File size: 4.1 KB
RevLine 
[12286]1## $Id: contracts.py 12571 2015-02-09 08:30:13Z henrik $
[12273]2##
3## Copyright (C) 2014 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"""
19Customer contract components.
20"""
21
22import grok
23from zope.component.interfaces import IFactory
24from zope.interface import implementedBy
25from waeup.ikoba.utils.helpers import attrs_to_fields
26from waeup.ikoba.customers.interfaces import ICustomerNavigation
27from waeup.ikoba.customers.contracts import ContractBase
[12371]28from ikobacustom.pcn.interfaces import MessageFactory as _
29from ikobacustom.pcn.customers.interfaces import (
[12571]30    IRONContract,
31    IRONContractEdit,
32    IRONContractProcess,
33    IRONContractOfficialUse,
34    IROPContract,
35    IROPContractEdit,
36    IROPContractProcess,
37    IROPContractOfficialUse,
38    IRPRContract,
39    IRPRContractEdit,
40    IRPRContractProcess,
41    IRPRContractOfficialUse,
42    )
[12273]43
44
[12484]45class RONContract(ContractBase):
[12273]46    """This is a sample contract.
47    """
48
49    grok.implements(
[12484]50        IRONContractProcess,
51        IRONContract,
52        IRONContractEdit,
[12335]53        ICustomerNavigation)
[12273]54
[12488]55    contract_category = 'ron'
[12273]56
[12484]57    form_fields_interface = IRONContract
[12273]58
[12484]59    edit_form_fields_interface = IRONContractEdit
[12273]60
[12501]61    ou_form_fields_interface = IRONContractOfficialUse
62
[12484]63    check_docs_interface = IRONContract
[12273]64
[12484]65RONContract = attrs_to_fields(RONContract)
[12273]66
67
[12484]68class RONContractFactory(grok.GlobalUtility):
[12273]69    """A factory for contracts.
70    """
71    grok.implements(IFactory)
[12484]72    grok.name(u'waeup.RONContract')
[12401]73    title = u"Create a new license contract.",
[12499]74    description = u"This factory instantiates new contract instances."
[12273]75
76    def __call__(self, *args, **kw):
[12484]77        return RONContract(*args, **kw)
[12273]78
79    def getInterfaces(self):
[12484]80        return implementedBy(RONContract)
[12499]81
82
83class ROPContract(ContractBase):
84    """This is a sample contract.
85    """
86
87    grok.implements(
88        IROPContractProcess,
89        IROPContract,
90        IROPContractEdit,
91        ICustomerNavigation)
92
93    contract_category = 'rop'
94
95    form_fields_interface = IROPContract
96
97    edit_form_fields_interface = IROPContractEdit
98
[12501]99    ou_form_fields_interface = IROPContractOfficialUse
100
[12499]101    check_docs_interface = IROPContract
102
103ROPContract = attrs_to_fields(ROPContract)
104
105
106class ROPContractFactory(grok.GlobalUtility):
107    """A factory for contracts.
108    """
109    grok.implements(IFactory)
110    grok.name(u'waeup.ROPContract')
111    title = u"Create a new license contract.",
112    description = u"This factory instantiates new contract instances."
113
114    def __call__(self, *args, **kw):
115        return ROPContract(*args, **kw)
116
117    def getInterfaces(self):
118        return implementedBy(ROPContract)
[12571]119
120
121class RPRContract(ContractBase):
122    """Registration in the Provisional Register contract.
123    """
124
125    grok.implements(
126        IRPRContractProcess,
127        IRPRContract,
128        IRPRContractEdit,
129        ICustomerNavigation)
130
131    contract_category = 'rpr'
132
133    form_fields_interface = IRPRContract
134
135    edit_form_fields_interface = IRPRContractEdit
136
137    ou_form_fields_interface = IRPRContractOfficialUse
138
139    check_docs_interface = IRPRContract
140
141RPRContract = attrs_to_fields(RPRContract)
142
143
144class RPRContractFactory(grok.GlobalUtility):
145    """A factory for contracts.
146    """
147    grok.implements(IFactory)
148    grok.name(u'waeup.RPRContract')
149    title = u"Create a new license contract.",
150    description = u"This factory instantiates new contract instances."
151
152    def __call__(self, *args, **kw):
153        return RPRContract(*args, **kw)
154
155    def getInterfaces(self):
156        return implementedBy(RPRContract)
Note: See TracBrowser for help on using the repository browser.