Changeset 16110 for main/waeup.kofa/trunk/src/waeup/kofa
- Timestamp:
- 8 Jun 2020, 10:54:31 (5 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_webservices.py
r15811 r16110 248 248 <value><string>1234</string></value> 249 249 <value><string>aa@aa.ng</string></value> 250 </data></array></value> 251 </param> 252 </params> 253 </methodResponse> 254 """ 255 xmlout = self.XMLRPC_post(REQUEST_XML) 256 self.assertEqual(xmlout, RESPONSE_XML) 257 return 258 259 def test_get_grad_student(self): 260 server = ServerProxy('http://localhost/app') 261 self.setup_student(self.student) 262 result = server.get_grad_student('123', 'aa@aa.ng') 263 self.assertEqual(result, 264 [True, False]) 265 REQUEST_XML = """\ 266 <?xml version="1.0"?> 267 <methodCall> 268 <methodName>get_grad_student</methodName> 269 <params> 270 <param> 271 <value><string>K1000000</string></value> 272 </param> 273 <param> 274 <value><string>aa@aa.ng</string></value> 275 </param> 276 </params> 277 </methodCall>""" 278 RESPONSE_XML = """\ 279 <?xml version='1.0'?> 280 <methodResponse> 281 <params> 282 <param> 283 <value><array><data> 284 <value><boolean>1</boolean></value> 285 <value><boolean>0</boolean></value> 250 286 </data></array></value> 251 287 </param> -
main/waeup.kofa/trunk/src/waeup/kofa/students/webservices.py
r15811 r16110 23 23 from zope.catalog.interfaces import ICatalog 24 24 from waeup.kofa.interfaces import ( 25 IUniversity, IExtFileStore, IFileStoreNameChooser, IKofaUtils 26 )25 IUniversity, IExtFileStore, IFileStoreNameChooser, IKofaUtils, 26 GRADUATED) 27 27 from waeup.kofa.utils.helpers import get_fileformat, to_timezone 28 28 from waeup.kofa.students.catalog import StudentsQuery … … 163 163 return [student.display_fullname, student.certcode, 164 164 student.phone, student.email] 165 166 @grok.require('waeup.Public') 167 def get_grad_student(self, identifier=None, email=None): 168 """Does student record exist and is graduated student with correct 169 email address? 170 """ 171 students = self.context['students'] 172 student = get_student(students, identifier) 173 if student is None: 174 return None 175 correct_email = False 176 has_graduated = False 177 if student.email == email: 178 correct_email = True 179 if student.state == GRADUATED: 180 has_graduated = True 181 return [correct_email, has_graduated] 165 182 166 183 @grok.require('waeup.xmlrpc')
Note: See TracChangeset for help on using the changeset viewer.