source: main/waeup.sirp/trunk/src/waeup/sirp/applicants/batching.py @ 7235

Last change on this file since 7235 was 7192, checked in by Henrik Bettermann, 13 years ago

Adjust copyright statement and svn keyword in applicants.

  • Property svn:keywords set to Id
File size: 2.1 KB
RevLine 
[7192]1## $Id: batching.py 7192 2011-11-25 07:15:50Z henrik $
[5321]2##
[7192]3## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
[5321]4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
[7192]8##
[5321]9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
[7192]13##
[5321]14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18"""Batch processing for applicants.
19"""
20import grok
21from zope.interface import Interface
22from waeup.sirp.interfaces import IBatchProcessor
23from waeup.sirp.utils.batching import BatchProcessor
[6251]24from waeup.sirp.applicants.interfaces import IApplicantsContainer
[5321]25
[6251]26class ApplicantsContainerImporter(BatchProcessor):
27    """An importer for applicants containers.
[5321]28    """
[5474]29    grok.implements(IBatchProcessor)
[5321]30    grok.provides(IBatchProcessor)
31    grok.context(Interface)
[6251]32    util_name = 'applicants container importer'
[5321]33    grok.name(util_name)
34
[6251]35    name = u'Applicants Container Importer'
[5475]36    mode = u'create'
[6251]37    iface = IApplicantsContainer
[5321]38
[6251]39    location_fields = ['code',]
[6282]40    factory_name = 'waeup.ApplicantsContainer'
[5321]41
42    def parentsExist(self, row, site):
[6251]43        return 'applicants' in site.keys()
[5321]44
45    def entryExists(self, row, site):
[6251]46        return row['code'] in site['applicants'].keys()
[5321]47
48    def getParent(self, row, site):
[6251]49        return site['applicants']
[5321]50
51    def getEntry(self, row, site):
52        if not self.entryExists(row, site):
53            return None
54        parent = self.getParent(row, site)
[6251]55        return parent.get(row['code'])
[5321]56
57    def addEntry(self, obj, row, site):
58        parent = self.getParent(row, site)
[6251]59        parent[row['code']] = obj
[5321]60        return
61
62    def delEntry(self, row, site):
63        parent = self.getParent(row, site)
[6251]64        del parent[row['code']]
[5321]65        return
Note: See TracBrowser for help on using the repository browser.