source: main/waeup.sirp/branches/accesscodes-with-workflow/src/waeup/sirp/accesscodes/interfaces.py @ 6411

Last change on this file since 6411 was 6406, checked in by Henrik Bettermann, 14 years ago

Add access code attributes 'state' and 'history'.

File size: 2.0 KB
Line 
1"""Interfaces of access code related components.
2"""
3from zope import schema
4from zope.interface import Interface, Attribute
5from waeup.sirp.interfaces import IWAeUPObject
6
7class IAccessCode(IWAeUPObject):
8    """An access code.
9    """
10    history = Attribute('Object history, a list of messages.')
11    state = Attribute('Returns the workflow state of an accesscode')
12
13    batch_serial = schema.Int(
14        title = u'Serial number inside batch',
15        )
16    batch_prefix = schema.TextLine(
17        title = u'Batch prefix',
18        )
19    batch_num = schema.Int(
20        title = u'Batch number',
21        )
22    random_num = schema.TextLine(
23        title = u'Random part of access code.',
24        )
25    cost = schema.Float(
26        title = u'Cost of access code',
27        default = 0.0, min = 0.0,
28        )
29    #invalidation_date = schema.Datetime(
30    #    title = u'Datetime of invalidation',
31    #    required = False,
32    #    default = None,
33    #    )
34    #student_id = schema.TextLine(
35    #    title = u'Student ID or registration number',
36    #    required = False,
37    #    default = None,
38    #    )
39    representation = schema.TextLine(
40        title = u'Complete title of access code',
41        )
42   
43class IAccessCodeBatch(Interface):
44    """A factory for batches of access codes.
45    """
46    creation_date = schema.Date(
47        title = u'Creation date',
48        )
49    creator = schema.TextLine(
50        title = u'Batch creator',
51        )
52    batch_prefix = schema.TextLine(
53        title = u'Batch prefix',
54        )
55    batch_num = schema.Int(
56        title = u'Batch number (1-3 digits)',
57        min = 0, max = 999,
58        )
59    entry_num = schema.Int(
60        title = u'Number of access codes',
61        default = 1000, min = 1,
62        )
63    cost = schema.Float(
64        title = u'Cost of access code',
65        default = 0.0, min = 0.0,
66        )
67
68class IAccessCodeBatchContainer(IWAeUPObject):
69    """A container for access code batches.
70    """
71
72    def addBatch(batch):
73        """Add a batch.
74        """
Note: See TracBrowser for help on using the repository browser.