[5649] | 1 | ## |
---|
| 2 | ## container.py |
---|
| 3 | ## Login : <uli@pu.smp.net> |
---|
| 4 | ## Started on Thu Jan 20 04:33:18 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 | ## |
---|
| 22 | """ |
---|
[5676] | 23 | Containers for university applicants. |
---|
[5649] | 24 | """ |
---|
| 25 | import grok |
---|
[5821] | 26 | from waeup.sirp.applicants.interfaces import ( |
---|
| 27 | IApplicantsContainer, IApplicantContainerProvider, |
---|
| 28 | ) |
---|
[5649] | 29 | |
---|
[5676] | 30 | class ApplicantsContainer(grok.Container): |
---|
| 31 | """An applicants container contains university applicants. |
---|
[5649] | 32 | """ |
---|
[5676] | 33 | grok.implements(IApplicantsContainer) |
---|
[5649] | 34 | |
---|
[5682] | 35 | REQUIRES_JAMBDATA = False |
---|
| 36 | name = None |
---|
[5821] | 37 | title = u'Simple applicant container' |
---|
| 38 | description = u'Simple container for regular applicants' |
---|
[5649] | 39 | startdate = None |
---|
| 40 | enddate = None |
---|
[5650] | 41 | strict_deadline = True |
---|
[5649] | 42 | |
---|
| 43 | def archive(self, app_ids=None): |
---|
[5676] | 44 | """Create on-dist archive of applicants stored in this term. |
---|
[5649] | 45 | |
---|
[5676] | 46 | If app_ids is `None`, all applicants are archived. |
---|
[5649] | 47 | |
---|
| 48 | If app_ids contains a single id string, only the respective |
---|
[5676] | 49 | applicants are archived. |
---|
[5649] | 50 | |
---|
| 51 | If app_ids contains a list of id strings all of the respective |
---|
[5676] | 52 | applicants types are saved to disk. |
---|
[5649] | 53 | """ |
---|
| 54 | raise NotImplemented() |
---|
| 55 | |
---|
| 56 | def clear(self, app_ids=None, archive=True): |
---|
[5676] | 57 | """Remove applicants of type given by 'id'. |
---|
[5649] | 58 | |
---|
[5676] | 59 | Optionally archive the applicants. |
---|
[5649] | 60 | |
---|
[5676] | 61 | If id is `None`, all applicants are archived. |
---|
[5649] | 62 | |
---|
| 63 | If id contains a single id string, only the respective |
---|
[5676] | 64 | applicants are archived. |
---|
[5649] | 65 | |
---|
| 66 | If id contains a list of id strings all of the respective |
---|
[5676] | 67 | applicant types are saved to disk. |
---|
[5649] | 68 | |
---|
| 69 | If `archive` is ``False`` none of the archive-handling is done |
---|
[5676] | 70 | and respective applicants are simply removed from the |
---|
[5649] | 71 | database. |
---|
| 72 | """ |
---|
| 73 | raise NotImplemented() |
---|
[5682] | 74 | |
---|
| 75 | class JAMBBasedApplicantsContainer(ApplicantsContainer): |
---|
| 76 | """An applicants container contains university applicants. |
---|
| 77 | |
---|
| 78 | For applicants added to this container JAMB data must be available |
---|
| 79 | already. |
---|
| 80 | """ |
---|
| 81 | REQUIRES_JAMBDATA = True |
---|
[5821] | 82 | |
---|
| 83 | class ApplicantsContainerProvider(grok.GlobalUtility): |
---|
| 84 | """A utility that provides basic applicants containers. |
---|
| 85 | """ |
---|
| 86 | grok.implements(IApplicantContainerProvider) |
---|
| 87 | grok.name('waeup.sirp.applicant.ApplicantsContainer') |
---|
| 88 | |
---|
| 89 | factory = ApplicantsContainer |
---|