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

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

Use NotImplemented? correctly.

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