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

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

Use new field-property setter with real class.

File size: 2.6 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, IApplicantsContainerAdd,
28    IApplicantsContainerProvider,
29    )
30from waeup.sirp.utils.helpers import attrs_to_fields
31
32class ApplicantsContainer(grok.Container):
33    """An applicants container contains university applicants.
34    """
35    grok.implements(IApplicantsContainer,IApplicantsContainerAdd)
36    #grok.provides(IApplicantsContainer)
37
38    def archive(self, app_ids=None):
39        """Create on-dist archive of applicants stored in this term.
40
41        If app_ids is `None`, all applicants are archived.
42
43        If app_ids contains a single id string, only the respective
44        applicants are archived.
45
46        If app_ids contains a list of id strings all of the respective
47        applicants types are saved to disk.
48        """
49        raise NotImplemented()
50
51    def clear(self, app_ids=None, archive=True):
52        """Remove applicants of type given by 'id'.
53
54        Optionally archive the applicants.
55       
56        If id is `None`, all applicants are archived.
57
58        If id contains a single id string, only the respective
59        applicants are archived.
60
61        If id contains a list of id strings all of the respective
62        applicant types are saved to disk.
63
64        If `archive` is ``False`` none of the archive-handling is done
65        and respective applicants are simply removed from the
66        database.
67        """
68        raise NotImplemented()
69
70ApplicantsContainer = attrs_to_fields(ApplicantsContainer)
71   
72class ApplicantsContainerProvider(grok.GlobalUtility):
73    """A utility that provides basic applicants containers.
74    """
75    grok.implements(IApplicantsContainerProvider)
76    grok.name('waeup.sirp.applicants.ApplicantsContainer')
77
78    factory = ApplicantsContainer
Note: See TracBrowser for help on using the repository browser.