[5068] | 1 | """Interfaces of access code related components. |
---|
| 2 | """ |
---|
| 3 | |
---|
| 4 | from zope import schema |
---|
| 5 | from zope.interface import Interface |
---|
[5081] | 6 | from waeup.sirp.interfaces import IWAeUPObject |
---|
[5068] | 7 | |
---|
[5081] | 8 | class IAccessCode(IWAeUPObject): |
---|
[5068] | 9 | """An access code. |
---|
| 10 | """ |
---|
| 11 | batch_serial = schema.Int( |
---|
| 12 | title = u'Serial number inside batch', |
---|
| 13 | ) |
---|
| 14 | batch_prefix = schema.TextLine( |
---|
| 15 | title = u'Prefix inside batch', |
---|
| 16 | ) |
---|
| 17 | batch_num = schema.Int( |
---|
| 18 | title = u'Batch number', |
---|
| 19 | ) |
---|
| 20 | random_num = schema.TextLine( |
---|
| 21 | title = u'Random part of access code.', |
---|
| 22 | ) |
---|
| 23 | cost = schema.Float( |
---|
| 24 | title = u'Cost of access code', |
---|
| 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 | |
---|
| 37 | class IAccessCodeBatch(Interface): |
---|
| 38 | """A factory for batches of access codes. |
---|
| 39 | """ |
---|
| 40 | creation_date = schema.Date( |
---|
| 41 | title = u'Creation date', |
---|
| 42 | ) |
---|
| 43 | creator = schema.TextLine( |
---|
| 44 | title = u'Batch creator', |
---|
| 45 | ) |
---|
| 46 | batch_prefix = schema.TextLine( |
---|
| 47 | title = u'Prefix inside batch', |
---|
| 48 | ) |
---|
| 49 | batch_num = schema.Int( |
---|
| 50 | title = u'Batch number', |
---|
| 51 | ) |
---|
[5081] | 52 | |
---|
| 53 | class IAccessCodeBatchContainer(IWAeUPObject): |
---|
| 54 | """A container for access code batches. |
---|
| 55 | """ |
---|
| 56 | |
---|
| 57 | def addBatch(batch): |
---|
| 58 | """Add a batch. |
---|
| 59 | """ |
---|