[5068] | 1 | """Interfaces of access code related components. |
---|
| 2 | """ |
---|
| 3 | from zope import schema |
---|
| 4 | from zope.interface import Interface |
---|
[5081] | 5 | from waeup.sirp.interfaces import IWAeUPObject |
---|
[5068] | 6 | |
---|
[5081] | 7 | class 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 | ) |
---|
| 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 | ) |
---|
[5098] | 36 | representation = schema.TextLine( |
---|
| 37 | title = u'Complete title of access code', |
---|
| 38 | ) |
---|
| 39 | |
---|
[5068] | 40 | class 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( |
---|
[5085] | 50 | title = u'Batch prefix', |
---|
[5068] | 51 | ) |
---|
| 52 | batch_num = schema.Int( |
---|
[5085] | 53 | title = u'Batch number (1-3 digits)', |
---|
| 54 | min = 0, max = 999, |
---|
[5068] | 55 | ) |
---|
[5085] | 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 | ) |
---|
[5081] | 64 | |
---|
| 65 | class IAccessCodeBatchContainer(IWAeUPObject): |
---|
| 66 | """A container for access code batches. |
---|
| 67 | """ |
---|
| 68 | |
---|
| 69 | def addBatch(batch): |
---|
| 70 | """Add a batch. |
---|
| 71 | """ |
---|