Changeset 7374 for main/waeup.sirp/trunk/src
- Timestamp:
- 18 Dec 2011, 11:20:19 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/applicants
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/root.py
r7321 r7374 102 102 return 103 103 104 def get_applicant_data(identifier):105 """Get applicant data associated with `identifier`.106 107 Returns the applicant object if successful and ``None`` else.108 109 As `identifier` we expect an access code in format110 like ``PREFIX-XXX-YYYYYYYY`` where ``PREFIX`` is something like111 ``APP`` or ``PUDE``, ``XXX`` the access code series and112 ``YYYYYYYYYY`` the real accesscode number.113 114 This function requires a fully blown setup as it does catalog115 lookups for finding applicants.116 """117 query = getUtility(IQuery)118 results = list(query.searchResults(119 Eq(('applicants_catalog', 'access_code'), identifier)120 ))121 if len(results) == 0:122 return None123 return results[0]124 125 104 def application_exists(identifier): 126 105 """Check whether an application for the given identifier already -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_root.py
r7193 r7374 218 218 self.ac = u'APP-99999' 219 219 self.applicant = Applicant() 220 self.applicant.access_code = self.ac220 #self.applicant.access_code = self.ac 221 221 self.app['applicants']['foo'][self.ac] = self.applicant 222 222 return … … 233 233 result = application_exists('APP-44444') 234 234 assert result is False 235 return236 237 def test_get_applicant_data(self):238 result = get_applicant_data('APP-99999')239 self.assertEqual(result, self.applicant)240 return241 242 def test_get_applicant_data_none(self):243 result = get_applicant_data('NOT-EXISTIING')244 assert result is None245 235 return 246 236
Note: See TracChangeset for help on using the changeset viewer.