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

Last change on this file since 6064 was 5098, checked in by uli, 15 years ago

Add representation field in AccessCode? interface.

File size: 1.8 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    invalidation_date = schema.Datetime(
27        title = u'Datetime of invalidation',
28        required = False,
29        default = None,
30        )
31    student_id = schema.TextLine(
32        title = u'Student ID or registration number',
33        required = False,
34        default = None,
35        )
36    representation = schema.TextLine(
37        title = u'Complete title of access code',
38        )
39   
40class IAccessCodeBatch(Interface):
41    """A factory for batches of access codes.
42    """
43    creation_date = schema.Date(
44        title = u'Creation date',
45        )
46    creator = schema.TextLine(
47        title = u'Batch creator',
48        )
49    batch_prefix = schema.TextLine(
50        title = u'Batch prefix',
51        )
52    batch_num = schema.Int(
53        title = u'Batch number (1-3 digits)',
54        min = 0, max = 999,
55        )
56    entry_num = schema.Int(
57        title = u'Number of access codes',
58        default = 1000, min = 1,
59        )
60    cost = schema.Float(
61        title = u'Cost of access code',
62        default = 0.0, min = 0.0,
63        )
64
65class IAccessCodeBatchContainer(IWAeUPObject):
66    """A container for access code batches.
67    """
68
69    def addBatch(batch):
70        """Add a batch.
71        """
Note: See TracBrowser for help on using the repository browser.