source: main/waeup.sirp/trunk/src/waeup/sirp/applicants/jambtables/container.py @ 5880

Last change on this file since 5880 was 5880, checked in by uli, 13 years ago

Copy containers and tests to jambdata/ to get the jamb-related stuff out of the way.

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