Changeset 11668 for main/waeup.kofa/trunk/src/waeup/kofa/students
- Timestamp:
- 26 May 2014, 16:27:50 (11 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
r11666 r11668 395 395 'fingerprints': {}, 396 396 'img': None, 397 'img_name': None, 397 398 }) 399 400 def test_get_student_fingerprints_passport(self): 401 # we get a photograph of the student if avail. 402 server = ServerProxy('http://mgr:mgrpw@localhost/app') 403 self.setup_student(self.student) 404 self.create_passport_img(self.student) 405 result = server.get_student_fingerprints(self.student.student_id) 406 self.assertTrue( 407 isinstance(result['img'], xmlrpclib.Binary)) 408 self.assertEqual(result['img_name'], 'passport_K1000000.jpg') 398 409 399 410 def test_get_student_fingerprints_block_unauthorized(self): -
main/waeup.kofa/trunk/src/waeup/kofa/students/webservices.py
r11667 r11668 17 17 ## 18 18 import grok 19 import os 19 20 import xmlrpclib 20 21 from zope.component import getUtility, queryUtility … … 241 242 firstname=student.firstname, 242 243 lastname=student.lastname, 244 fingerprints={}, 245 img_name=None, 243 246 img=None, 244 fingerprints={},245 247 ) 246 248 file_store = getUtility(IExtFileStore) 247 for num in [str(x+1) for x in range(10)]: 249 img = file_store.getFileByContext(student, attr='passport.jpg') 250 if img is not None: 251 result.update( 252 img=xmlrpclib.Binary(img.read()), 253 img_name=os.path.basename(img.name)) 254 255 256 for num in [str(x + 1) for x in range(10)]: 248 257 fp_file = getUtility(IExtFileStore).getFileByContext( 249 258 student, attr='%s.fpm' % num)
Note: See TracChangeset for help on using the changeset viewer.