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

Last change on this file since 5867 was 5858, checked in by uli, 14 years ago

Display applicants container name in breadcrumbs.

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