## ## container.py ## Login : ## Started on Thu Jan 20 04:33:18 2011 Uli Fouquet ## $Id$ ## ## Copyright (C) 2011 Uli Fouquet ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## """ Containers for university applicants. """ import grok from waeup.sirp.applicants.interfaces import ( IApplicantsContainer, IApplicantsContainerAdd, IApplicantsContainerProvider, ) from waeup.sirp.utils.helpers import attrs_to_fields class ApplicantsContainer(grok.Container): """An applicants container contains university applicants. """ grok.implements(IApplicantsContainer,IApplicantsContainerAdd) #grok.provides(IApplicantsContainer) #: These are 'class-attributes'. Do not fiddle around with it in #: instances of this class. #: #: The title of this container as displayed in add-forms. It should #: give some idea about what kind of container this is (one or two words) container_title = u'Basic' #: Another 'class-attribute'. Do not fiddle around with it in instances #: of this class. #: #: The `container_description` gives a short explanation about for what #: purposes this container type serves (a few words only). container_description = u'handles basic applicants' @property def local_roles(cls): return ['waeup.local.ApplicationsOfficer'] def archive(self, app_ids=None): """Create on-dist archive of applicants stored in this term. If app_ids is `None`, all applicants are archived. If app_ids contains a single id string, only the respective applicants are archived. If app_ids contains a list of id strings all of the respective applicants types are saved to disk. """ raise NotImplemented() def clear(self, app_ids=None, archive=True): """Remove applicants of type given by 'id'. Optionally archive the applicants. If id is `None`, all applicants are archived. If id contains a single id string, only the respective applicants are archived. If id contains a list of id strings all of the respective applicant types are saved to disk. If `archive` is ``False`` none of the archive-handling is done and respective applicants are simply removed from the database. """ raise NotImplemented() ApplicantsContainer = attrs_to_fields(ApplicantsContainer) class ApplicantsContainerProvider(grok.GlobalUtility): """A utility that provides basic applicants containers. """ grok.implements(IApplicantsContainerProvider) grok.name('waeup.sirp.applicants.ApplicantsContainer') #: The applicants container type this provider provides: #: :class:`ApplicantsContainer`. factory = ApplicantsContainer