Changeset 7264


Ignore:
Timestamp:
4 Dec 2011, 13:34:26 (13 years ago)
Author:
uli
Message:

Fix importer semantics. Methods named like booleans (entryExists)
should return boolean values.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/batching.py

    r7263 r7264  
    9797
    9898    def entryExists(self, row, site):
    99         if not self.parentsExist(row, site):
    100             return None
    101         parent = self.getParent(row, site)
    102         if 'application_number' in row.keys() and row['application_number']:
    103             if row['application_number'] in parent.keys():
    104                 return parent[row['application_number']]
    105         return None
     99        return self.getEntry(row, site) is not None
    106100
    107101    def getParent(self, row, site):
     
    109103
    110104    def getEntry(self, row, site):
    111         return self.entryExists(row, site)
     105        if not self.parentsExist(row, site):
     106            return None
     107        parent = self.getParent(row, site)
     108        return parent.get(row.get('application_number', None), None)
    112109
    113110    def addEntry(self, obj, row, site):
     
    117114
    118115    def delEntry(self, row, site):
    119         applicant = self.entryExists(row, site)
    120         if applicant is not None:
     116        if self.entryExists(row, site):
    121117            parent = self.getParent(row, site)
    122118            del parent[row['application_number']]
Note: See TracChangeset for help on using the changeset viewer.