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
RevLine 
[5068]1"""Interfaces of access code related components.
2"""
3from zope import schema
4from zope.interface import Interface
[5081]5from waeup.sirp.interfaces import IWAeUPObject
[5068]6
[5081]7class IAccessCode(IWAeUPObject):
[5068]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',
[5085]24        default = 0.0, min = 0.0,
[5068]25        )
[6419]26    disabled = schema.Bool(
27        title = u'Access code is disabled',
28        default = False,
29        readonly = True,
[5068]30        )
[6419]31    used = schema.Bool(
32        title = u'Access code is already in use.',
33        default = False,
34        readonly = True,
[5068]35        )
[5098]36    representation = schema.TextLine(
37        title = u'Complete title of access code',
38        )
[6423]39    history = schema.Text(
40        title = u'The history of access code as lines',
41        default = u'',
42        readonly = True,
43       )
[6413]44
[5068]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        )
[6415]54    prefix = schema.TextLine(
[5085]55        title = u'Batch prefix',
[5068]56        )
[6415]57    num = schema.Int(
[5085]58        title = u'Batch number (1-3 digits)',
59        min = 0, max = 999,
[5068]60        )
[5085]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        )
[6425]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        )
[5081]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.