Changeset 8615
- Timestamp:
- 3 Jun 2012, 13:33:47 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/batching.py
r8581 r8615 154 154 155 155 def getParent(self, row, site): 156 result = None 156 157 if self.getLocator(row) == 'container_code': 157 re turnsite['applicants'].get(row['container_code'], None)158 if self.getLocator(row) == 'reg_number':158 result = site['applicants'].get(row['container_code'], None) 159 elif self.getLocator(row) == 'reg_number': 159 160 reg_number = row['reg_number'] 160 161 cat = queryUtility(ICatalog, name='applicants_catalog') … … 162 163 cat.searchResults(reg_number=(reg_number, reg_number))) 163 164 if results: 164 re turnresults[0].__parent__165 if self.getLocator(row) == 'applicant_id':165 result = results[0].__parent__ 166 elif self.getLocator(row) == 'applicant_id': 166 167 applicant_id = row['applicant_id'] 167 168 cat = queryUtility(ICatalog, name='applicants_catalog') … … 169 170 cat.searchResults(applicant_id=(applicant_id, applicant_id))) 170 171 if results: 171 re turnresults[0].__parent__172 return None172 result = results[0].__parent__ 173 return result 173 174 174 175 def parentsExist(self, row, site): … … 301 302 errs, inv_errs, conv_dict = converter.fromStringDict( 302 303 row, self.factory_name, mode=mode) 304 cert = conv_dict.get('course1', None) 305 if cert is not None and (mode in ('create', 'update')): 306 # course1 application category must match container's. We 307 # could move that check into addApplicant, as it is 308 # expensive. 309 # 310 # XXX: getSite() should be avoided here. 311 parent = self.getParent(row, grok.getSite()) 312 if cert.application_category != parent.application_category: 313 errs.append(('course1', 'wrong application category')) 303 314 if row.has_key('state') and \ 304 315 not row['state'] in IMPORTABLE_STATES:
Note: See TracChangeset for help on using the changeset viewer.