Ignore:
Timestamp:
4 Dec 2011, 16:01:15 (13 years ago)
Author:
Henrik Bettermann
Message:

Fix importer semantic also in students (see last comment of Uli).

Location:
main/waeup.sirp/trunk/src/waeup/sirp/students
Files:
2 edited

Legend:

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

    r7263 r7267  
    9595    # The entry never exists in create mode.
    9696    def entryExists(self, row, site):
     97        return self.getEntry(row, site) is not None
     98
     99    def getParent(self, row, site):
     100        return site['students']
     101
     102    def getEntry(self, row, site):
    97103        if not 'students' in site.keys():
    98104            return None
     
    117123        return None
    118124
    119     def getParent(self, row, site):
    120         return site['students']
    121 
    122     def getEntry(self, row, site):
    123         return self.entryExists(row, site)
    124 
     125       
    125126    def addEntry(self, obj, row, site):
    126127        parent = self.getParent(row, site)
     
    129130
    130131    def delEntry(self, row, site):
    131         student = self.entryExists(row, site)
     132        student = self.getEntry(row, site)
    132133        if student is not None:
    133134            parent = self.getParent(row, site)
     
    203204        return True
    204205
    205     def parentsExist(self, row, site):
     206    def getParent(self, row, site):
    206207        if not 'students' in site.keys():
    207208            return None
     
    227228        return None
    228229
     230    def parentsExist(self, row, site):
     231        return self.getParent(row, site) is not None
     232
    229233    def entryExists(self, row, site):
    230         student = self.parentsExist(row, site)
     234        student = self.getParent(row, site)
    231235        if not student:
    232236            return None
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_batching.py

    r7263 r7267  
    116116
    117117    def test_parentsExist(self):
    118         assert self.importer.parentsExist(None, dict()) is False
    119         assert self.importer.parentsExist(None, self.app) is True
     118        self.assertFalse(self.importer.parentsExist(None, dict()))
     119        self.assertTrue(self.importer.parentsExist(None, self.app))
    120120
    121121    def test_entryExists(self):
    122         assert self.importer.entryExists(
    123             dict(student_id='ID_NONE'), self.app) is None
     122        self.assertFalse(assert self.importer.entryExists(
     123            dict(student_id='ID_NONE'), self.app))
    124124        student = self.importer.getEntry(
    125125            dict(student_id=self.student.student_id), self.app)
Note: See TracChangeset for help on using the changeset viewer.