Changeset 15811


Ignore:
Timestamp:
17 Nov 2019, 08:18:54 (5 years ago)
Author:
Henrik Bettermann
Message:

Return array of structs and not array of arrays.

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

    r15798 r15811  
    542542        result = server.get_bursary_data(None,None,None,None,'dep1')
    543543        self.assertEqual(
    544             result, [
    545             ['K1000000', '234', '123', 'Anna', None, 'Tester', 'created',
    546              2004, 2004, None, 'fac1', 'dep1', 'CERT1', 'my-id1', 12.12,
    547              'schoolfee', None, 2012, 'paid',
    548              str('%s#' % to_timezone(payment1.creation_date, tz)), 'None#'],
    549             ['K1000000', '234', '123', 'Anna', None, 'Tester',
    550              'created', 2004, 2004, None, 'fac1', 'dep1', 'CERT1',
    551              'my-id2', 12.12, 'clearance', None, 2012, 'paid',
    552              str('%s#' % to_timezone(payment2.creation_date, tz)), 'None#']]
    553              )
     544            result,[
     545            {'entry_mode': None, 'reg_number': '123', 'display_item': None,
     546                'firstname': 'Anna', 'payment_date': 'None#',
     547                'middlename': None, 'student_id': 'K1000000', 'p_id':
     548                'my-id1', 'certcode': 'CERT1', 'entry_session': 2004,
     549                'creation_date': str('%s#' % to_timezone(payment1.creation_date, tz)),
     550                'state': 'created', 'current_session': 2004,
     551                'faccode': 'fac1', 'lastname': 'Tester',
     552                'p_category': 'schoolfee', 'amount_auth': 12.12,
     553                'p_state': 'paid', 'p_session': 2012, 'matric_number': '234',
     554                'depcode': 'dep1'},
     555            {'entry_mode': None, 'reg_number': '123', 'display_item': None,
     556                'firstname': 'Anna', 'payment_date': 'None#',
     557                'middlename': None, 'student_id': 'K1000000',
     558                'p_id': 'my-id2', 'certcode': 'CERT1', 'entry_session': 2004,
     559                'creation_date': str('%s#' % to_timezone(payment2.creation_date, tz)),
     560                'state': 'created', 'current_session': 2004, 'faccode': 'fac1',
     561                'lastname': 'Tester', 'p_category': 'clearance',
     562                'amount_auth': 12.12, 'p_state': 'paid', 'p_session': 2012,
     563                'matric_number': '234', 'depcode': 'dep1'}
     564            ]
     565            )
     566
    554567        REQUEST_XML = """\
    555568<?xml version="1.0"?>
     
    572585<param>
    573586<value><array><data>
    574 <value><array><data>
    575 <value><string>K1000000</string></value>
     587<value><struct>
     588<member>
     589<name>entry_mode</name>
     590<value><nil/></value></member>
     591<member>
     592<name>reg_number</name>
     593<value><string>123</string></value>
     594</member>
     595<member>
     596<name>display_item</name>
     597<value><nil/></value></member>
     598<member>
     599<name>firstname</name>
     600<value><string>Anna</string></value>
     601</member>
     602<member>
     603<name>payment_date</name>
     604<value><string>None#</string></value>
     605</member>
     606<member>
     607<name>middlename</name>
     608<value><nil/></value></member>
     609<member>
     610<name>student_id</name>
     611<value><string>K1000000</string></value>
     612</member>
     613<member>
     614<name>p_id</name>
     615<value><string>my-id1</string></value>
     616</member>
     617<member>
     618<name>certcode</name>
     619<value><string>CERT1</string></value>
     620</member>
     621<member>
     622<name>creation_date</name>
     623<value><string>%s</string></value>
     624</member>
     625<member>
     626<name>matric_number</name>
    576627<value><string>234</string></value>
     628</member>
     629<member>
     630<name>state</name>
     631<value><string>created</string></value>
     632</member>
     633<member>
     634<name>lastname</name>
     635<value><string>Tester</string></value>
     636</member>
     637<member>
     638<name>current_session</name>
     639<value><int>2004</int></value>
     640</member>
     641<member>
     642<name>faccode</name>
     643<value><string>fac1</string></value>
     644</member>
     645<member>
     646<name>entry_session</name>
     647<value><int>2004</int></value>
     648</member>
     649<member>
     650<name>p_category</name>
     651<value><string>schoolfee</string></value>
     652</member>
     653<member>
     654<name>amount_auth</name>
     655<value><double>12.12</double></value>
     656</member>
     657<member>
     658<name>p_session</name>
     659<value><int>2012</int></value>
     660</member>
     661<member>
     662<name>p_state</name>
     663<value><string>paid</string></value>
     664</member>
     665<member>
     666<name>depcode</name>
     667<value><string>dep1</string></value>
     668</member>
     669</struct></value>
     670<value><struct>
     671<member>
     672<name>entry_mode</name>
     673<value><nil/></value></member>
     674<member>
     675<name>reg_number</name>
    577676<value><string>123</string></value>
     677</member>
     678<member>
     679<name>display_item</name>
     680<value><nil/></value></member>
     681<member>
     682<name>firstname</name>
    578683<value><string>Anna</string></value>
    579 <value><nil/></value><value><string>Tester</string></value>
     684</member>
     685<member>
     686<name>payment_date</name>
     687<value><string>None#</string></value>
     688</member>
     689<member>
     690<name>middlename</name>
     691<value><nil/></value></member>
     692<member>
     693<name>student_id</name>
     694<value><string>K1000000</string></value>
     695</member>
     696<member>
     697<name>p_id</name>
     698<value><string>my-id2</string></value>
     699</member>
     700<member>
     701<name>certcode</name>
     702<value><string>CERT1</string></value>
     703</member>
     704<member>
     705<name>creation_date</name>
     706<value><string>%s</string></value>
     707</member>
     708<member>
     709<name>matric_number</name>
     710<value><string>234</string></value>
     711</member>
     712<member>
     713<name>state</name>
    580714<value><string>created</string></value>
     715</member>
     716<member>
     717<name>lastname</name>
     718<value><string>Tester</string></value>
     719</member>
     720<member>
     721<name>current_session</name>
    581722<value><int>2004</int></value>
     723</member>
     724<member>
     725<name>faccode</name>
     726<value><string>fac1</string></value>
     727</member>
     728<member>
     729<name>entry_session</name>
    582730<value><int>2004</int></value>
    583 <value><nil/></value><value><string>fac1</string></value>
     731</member>
     732<member>
     733<name>p_category</name>
     734<value><string>clearance</string></value>
     735</member>
     736<member>
     737<name>amount_auth</name>
     738<value><double>12.12</double></value>
     739</member>
     740<member>
     741<name>p_session</name>
     742<value><int>2012</int></value>
     743</member>
     744<member>
     745<name>p_state</name>
     746<value><string>paid</string></value>
     747</member>
     748<member>
     749<name>depcode</name>
    584750<value><string>dep1</string></value>
    585 <value><string>CERT1</string></value>
    586 <value><string>my-id1</string></value>
    587 <value><double>12.12</double></value>
    588 <value><string>schoolfee</string></value>
    589 <value><nil/></value><value><int>2012</int></value>
    590 <value><string>paid</string></value>
    591 <value><string>%s</string></value>
    592 <value><string>None#</string></value>
    593 </data></array></value>
    594 <value><array><data>
    595 <value><string>K1000000</string></value>
    596 <value><string>234</string></value>
    597 <value><string>123</string></value>
    598 <value><string>Anna</string></value>
    599 <value><nil/></value><value><string>Tester</string></value>
    600 <value><string>created</string></value>
    601 <value><int>2004</int></value>
    602 <value><int>2004</int></value>
    603 <value><nil/></value><value><string>fac1</string></value>
    604 <value><string>dep1</string></value>
    605 <value><string>CERT1</string></value>
    606 <value><string>my-id2</string></value>
    607 <value><double>12.12</double></value>
    608 <value><string>clearance</string></value>
    609 <value><nil/></value><value><int>2012</int></value>
    610 <value><string>paid</string></value>
    611 <value><string>%s</string></value>
    612 <value><string>None#</string></value>
    613 </data></array></value>
     751</member>
     752</struct></value>
    614753</data></array></value>
    615754</param>
  • main/waeup.kofa/trunk/src/waeup/kofa/students/webservices.py

    r15798 r15811  
    371371        tz = getUtility(IKofaUtils).tzinfo
    372372        for payment in payments:
    373             hitlist.append(
    374                 (
    375                 payment.student.student_id,
    376                 payment.student.matric_number,
    377                 payment.student.reg_number,
    378                 payment.student.firstname,
    379                 payment.student.middlename,
    380                 payment.student.lastname,
    381                 payment.student.state,
    382                 payment.student.current_session,
    383                 payment.student.entry_session,
    384                 payment.student.entry_mode,
    385                 payment.student.faccode,
    386                 payment.student.depcode,
    387                 payment.student.certcode,
    388                 payment.p_id,
    389                 payment.amount_auth,
    390                 payment.p_category,
    391                 payment.display_item,
    392                 payment.p_session,
    393                 payment.p_state,
    394                 str('%s#' % to_timezone(payment.creation_date, tz)),
    395                 str('%s#' % to_timezone(payment.payment_date, tz)),
     373            hitlist.append(dict(
     374                student_id=payment.student.student_id,
     375                matric_number=payment.student.matric_number,
     376                reg_number=payment.student.reg_number,
     377                firstname=payment.student.firstname,
     378                middlename=payment.student.middlename,
     379                lastname=payment.student.lastname,
     380                state=payment.student.state,
     381                current_session=payment.student.current_session,
     382                entry_session=payment.student.entry_session,
     383                entry_mode=payment.student.entry_mode,
     384                faccode=payment.student.faccode,
     385                depcode=payment.student.depcode,
     386                certcode=payment.student.certcode,
     387                p_id=payment.p_id,
     388                amount_auth=payment.amount_auth,
     389                p_category=payment.p_category,
     390                display_item=payment.display_item,
     391                p_session=payment.p_session,
     392                p_state=payment.p_state,
     393                creation_date=str('%s#' % to_timezone(payment.creation_date, tz)),
     394                payment_date=str('%s#' % to_timezone(payment.payment_date, tz)),
    396395                )
    397                 )
     396              )
    398397        return hitlist
Note: See TracChangeset for help on using the changeset viewer.