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

Last change on this file since 6185 was 6184, checked in by Henrik Bettermann, 14 years ago

Implement local role assignment and removal in application section.

browser.py line 341: Use correct context for the IPrincipalRoleManager adapter.

File size: 3.4 KB
RevLine 
[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$
[6077]6##
[5649]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.
[6077]12##
[5649]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.
[6077]17##
[5649]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]23Containers for university applicants.
[5649]24"""
25import grok
[5821]26from waeup.sirp.applicants.interfaces import (
[6069]27    IApplicantsContainer, IApplicantsContainerAdd,
28    IApplicantsContainerProvider,
[5821]29    )
[6072]30from waeup.sirp.utils.helpers import attrs_to_fields
[5649]31
[5676]32class ApplicantsContainer(grok.Container):
33    """An applicants container contains university applicants.
[5649]34    """
[6069]35    grok.implements(IApplicantsContainer,IApplicantsContainerAdd)
36    #grok.provides(IApplicantsContainer)
[5649]37
[6074]38    #: These are 'class-attributes'. Do not fiddle around with it in
39    #: instances of this class.
40    #:
41    #: The title of this container as displayed in add-forms. It should
42    #: give some idea about what kind of container this is (one or two words)
43    container_title = u'Basic'
44
45    #: Another 'class-attribute'. Do not fiddle around with it in instances
46    #: of this class.
47    #:
48    #: The `container_description` gives a short explanation about for what
49    #: purposes this container type serves (a few words only).
50    container_description = u'handles basic applicants'
[6077]51
[6184]52    @property
53    def local_roles(cls):
54        return ['waeup.local.ApplicationsOfficer']
55
[5649]56    def archive(self, app_ids=None):
[5676]57        """Create on-dist archive of applicants stored in this term.
[5649]58
[5676]59        If app_ids is `None`, all applicants are archived.
[5649]60
61        If app_ids contains a single id string, only the respective
[5676]62        applicants are archived.
[5649]63
64        If app_ids contains a list of id strings all of the respective
[5676]65        applicants types are saved to disk.
[5649]66        """
67        raise NotImplemented()
68
69    def clear(self, app_ids=None, archive=True):
[5676]70        """Remove applicants of type given by 'id'.
[5649]71
[5676]72        Optionally archive the applicants.
[6077]73
[5676]74        If id is `None`, all applicants are archived.
[5649]75
76        If id contains a single id string, only the respective
[5676]77        applicants are archived.
[5649]78
79        If id contains a list of id strings all of the respective
[5676]80        applicant types are saved to disk.
[5649]81
82        If `archive` is ``False`` none of the archive-handling is done
[5676]83        and respective applicants are simply removed from the
[5649]84        database.
85        """
86        raise NotImplemented()
[6072]87
88ApplicantsContainer = attrs_to_fields(ApplicantsContainer)
[6077]89
[5821]90class ApplicantsContainerProvider(grok.GlobalUtility):
91    """A utility that provides basic applicants containers.
92    """
[5846]93    grok.implements(IApplicantsContainerProvider)
[6070]94    grok.name('waeup.sirp.applicants.ApplicantsContainer')
[5821]95
[6074]96    #: The applicants container type this provider provides:
97    #: :class:`ApplicantsContainer`.
[5821]98    factory = ApplicantsContainer
Note: See TracBrowser for help on using the repository browser.