source: main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/interfaces.py @ 6439

Last change on this file since 6439 was 6425, checked in by uli, 14 years ago

Support batch-local counters for used/disabled pins. This time we only set a simple attribute and remove the enable(), disable(), ... methods that have no purpose any more.

File size: 2.2 KB
Line 
1"""Interfaces of access code related components.
2"""
3from zope import schema
4from zope.interface import Interface
5from waeup.sirp.interfaces import IWAeUPObject
6
7class IAccessCode(IWAeUPObject):
8    """An access code.
9    """
10    batch_serial = schema.Int(
11        title = u'Serial number inside batch',
12        )
13    batch_prefix = schema.TextLine(
14        title = u'Prefix inside batch',
15        )
16    batch_num = schema.Int(
17        title = u'Batch number',
18        )
19    random_num = schema.TextLine(
20        title = u'Random part of access code.',
21        )
22    cost = schema.Float(
23        title = u'Cost of access code',
24        default = 0.0, min = 0.0,
25        )
26    disabled = schema.Bool(
27        title = u'Access code is disabled',
28        default = False,
29        readonly = True,
30        )
31    used = schema.Bool(
32        title = u'Access code is already in use.',
33        default = False,
34        readonly = True,
35        )
36    representation = schema.TextLine(
37        title = u'Complete title of access code',
38        )
39    history = schema.Text(
40        title = u'The history of access code as lines',
41        default = u'',
42        readonly = True,
43       )
44
45class IAccessCodeBatch(Interface):
46    """A factory for batches of access codes.
47    """
48    creation_date = schema.Date(
49        title = u'Creation date',
50        )
51    creator = schema.TextLine(
52        title = u'Batch creator',
53        )
54    prefix = schema.TextLine(
55        title = u'Batch prefix',
56        )
57    num = schema.Int(
58        title = u'Batch number (1-3 digits)',
59        min = 0, max = 999,
60        )
61    entry_num = schema.Int(
62        title = u'Number of access codes',
63        default = 1000, min = 1,
64        )
65    cost = schema.Float(
66        title = u'Cost of access code',
67        default = 0.0, min = 0.0,
68        )
69    disabled_num = schema.Int(
70        title = u'Number of disabled access codes inside the batch',
71        default = 0,
72        readonly = True,
73        )
74    used_num = schema.Int(
75        title = u'Number of used access codes inside the batch',
76        default = 0,
77        readonly = True,
78        )
79
80class IAccessCodeBatchContainer(IWAeUPObject):
81    """A container for access code batches.
82    """
83
84    def addBatch(batch):
85        """Add a batch.
86        """
Note: See TracBrowser for help on using the repository browser.