[5638] | 1 | ## |
---|
| 2 | ## interfaces.py |
---|
| 3 | ## Login : <uli@pu.smp.net> |
---|
| 4 | ## Started on Sun Jan 16 15:30:01 2011 Uli Fouquet |
---|
| 5 | ## $Id$ |
---|
| 6 | ## |
---|
| 7 | ## Copyright (C) 2011 Uli Fouquet |
---|
| 8 | ## This program is free software; you can redistribute it and/or modify |
---|
| 9 | ## it under the terms of the GNU General Public License as published by |
---|
| 10 | ## the Free Software Foundation; either version 2 of the License, or |
---|
| 11 | ## (at your option) any later version. |
---|
| 12 | ## |
---|
| 13 | ## This program is distributed in the hope that it will be useful, |
---|
| 14 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | ## GNU General Public License for more details. |
---|
| 17 | ## |
---|
| 18 | ## You should have received a copy of the GNU General Public License |
---|
| 19 | ## along with this program; if not, write to the Free Software |
---|
| 20 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 21 | ## |
---|
[5676] | 22 | """Interfaces regarding student applicants and related components. |
---|
[5638] | 23 | """ |
---|
| 24 | from zope import schema |
---|
[5681] | 25 | from waeup.sirp.interfaces import IWAeUPObject, SimpleWAeUPVocabulary |
---|
[5638] | 26 | |
---|
[5681] | 27 | #: Categories of applications we support. |
---|
| 28 | #: Yet not complete nor correct. |
---|
| 29 | APPLICATION_CATEGORIES = ( |
---|
| 30 | ('Direct Entry Screening Exam (PDE)', 'pde'), |
---|
| 31 | ('Post-UME', 'pume'), |
---|
| 32 | ('Post-UDE', 'pude'), |
---|
| 33 | ('PCE', 'pce'), |
---|
| 34 | ('Common Entry Screening Test (CEST)', 'cest'), |
---|
| 35 | ) |
---|
| 36 | |
---|
| 37 | #: A :class:`waeup.sirp.interfaces.SimpleWAeUPVocabulary` of supported |
---|
| 38 | #: application categories. |
---|
| 39 | application_categories_vocab = SimpleWAeUPVocabulary(*APPLICATION_CATEGORIES) |
---|
| 40 | |
---|
[5676] | 41 | class IApplicantsRoot(IWAeUPObject): |
---|
| 42 | """A container for university applicants containers. |
---|
[5645] | 43 | """ |
---|
[5676] | 44 | def addApplicantsContainer(container, name=None): |
---|
| 45 | """Add an applicants container. |
---|
[5638] | 46 | |
---|
[5676] | 47 | Adds an applicants container that implements `interface` |
---|
[5645] | 48 | under the name `name`. |
---|
[5638] | 49 | |
---|
[5645] | 50 | `container` the container instance to be added. Should |
---|
[5676] | 51 | implement :class:`IApplicantsContainer`. |
---|
[5645] | 52 | |
---|
| 53 | `name` |
---|
| 54 | the name under which the container will be accessible. We |
---|
| 55 | usually use names like ``pume_2011`` to indicate, that the |
---|
[5676] | 56 | new container will contain university applicants for a |
---|
[5645] | 57 | certain screening type (``pume``) and of the year 2011. |
---|
| 58 | """ |
---|
| 59 | |
---|
[5676] | 60 | class IApplicantsContainer(IWAeUPObject): |
---|
| 61 | """An applicants container contains university applicants. |
---|
[5645] | 62 | |
---|
[5638] | 63 | """ |
---|
[5682] | 64 | REQUIRES_JAMBDATA = schema.Bool( |
---|
| 65 | title = u'JAMB data required', |
---|
| 66 | description = u'This container requires JAMB data to be available.', |
---|
| 67 | required = True, |
---|
| 68 | default = False, |
---|
| 69 | ) |
---|
| 70 | |
---|
| 71 | name = schema.TextLine( |
---|
[5638] | 72 | title = u'Internal ID', |
---|
| 73 | required = True, |
---|
| 74 | ) |
---|
| 75 | |
---|
[5645] | 76 | title = schema.TextLine( |
---|
[5676] | 77 | title = u'Short description of the type of applicants stored here.', |
---|
[5645] | 78 | required = True, |
---|
| 79 | default = u'Untitled', |
---|
| 80 | ) |
---|
| 81 | |
---|
| 82 | description = schema.Text( |
---|
| 83 | title = u'Human readable description in reST format', |
---|
[5638] | 84 | required = False, |
---|
| 85 | default = u'Not set.' |
---|
| 86 | ) |
---|
| 87 | |
---|
| 88 | startdate = schema.Date( |
---|
[5645] | 89 | title = u'Date when the application period starts', |
---|
[5638] | 90 | required = False, |
---|
| 91 | default = None, |
---|
| 92 | ) |
---|
| 93 | |
---|
| 94 | enddate = schema.Date( |
---|
[5645] | 95 | title = u'Date when the application period ends', |
---|
[5638] | 96 | required = False, |
---|
| 97 | default = None, |
---|
| 98 | ) |
---|
| 99 | |
---|
[5645] | 100 | strict_deadline = schema.Bool( |
---|
| 101 | title = u'Forbid additions after deadline (enddate)', |
---|
| 102 | required = True, |
---|
| 103 | default = True, |
---|
| 104 | ) |
---|
[5638] | 105 | |
---|
| 106 | def archive(id=None): |
---|
[5676] | 107 | """Create on-dist archive of applicants stored in this term. |
---|
[5638] | 108 | |
---|
[5676] | 109 | If id is `None`, all applicants are archived. |
---|
[5638] | 110 | |
---|
| 111 | If id contains a single id string, only the respective |
---|
[5676] | 112 | applicants are archived. |
---|
[5638] | 113 | |
---|
| 114 | If id contains a list of id strings all of the respective |
---|
[5676] | 115 | applicants types are saved to disk. |
---|
[5638] | 116 | """ |
---|
| 117 | |
---|
| 118 | def clear(id=None, archive=True): |
---|
[5676] | 119 | """Remove applicants of type given by 'id'. |
---|
[5638] | 120 | |
---|
[5676] | 121 | Optionally archive the applicants. |
---|
[5638] | 122 | |
---|
[5676] | 123 | If id is `None`, all applicants are archived. |
---|
[5638] | 124 | |
---|
| 125 | If id contains a single id string, only the respective |
---|
[5676] | 126 | applicants are archived. |
---|
[5638] | 127 | |
---|
| 128 | If id contains a list of id strings all of the respective |
---|
[5676] | 129 | applicant types are saved to disk. |
---|
[5638] | 130 | |
---|
| 131 | If `archive` is ``False`` none of the archive-handling is done |
---|
[5676] | 132 | and respective applicants are simply removed from the |
---|
[5638] | 133 | database. |
---|
| 134 | """ |
---|