Ignore:
Timestamp:
13 Jun 2012, 06:32:13 (13 years ago)
Author:
Henrik Bettermann
Message:

Let's better use an adapter for the webservice.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/payments.py

    r8702 r8703  
    2626    IStudentPaymentsContainer, IStudentNavigation, IStudentOnlinePayment)
    2727from waeup.kofa.payments import PaymentsContainer, OnlinePayment
     28from waeup.kofa.payments.interfaces import IPaymentWebservice
    2829from waeup.kofa.utils.helpers import attrs_to_fields
    2930from waeup.kofa.accesscodes import create_accesscode
     
    5960        except AttributeError:
    6061            return None
    61 
    62     def getOwner(self):
    63         return self.getStudent()
    6462
    6563    def doAfterStudentPayment(self):
     
    132130StudentOnlinePayment = attrs_to_fields(StudentOnlinePayment)
    133131
     132class PaymentWebservice(grok.Adapter):
     133    """An adapter to publish student data through a webservice.
     134    """
     135    grok.context(IStudentOnlinePayment)
     136    grok.implements(IPaymentWebservice)
     137
     138    @property
     139    def payee(self):
     140        return self.context.getStudent().display_fullname
     141
    134142# Student online payments must be importable. So we might need a factory.
    135143class StudentOnlinePaymentFactory(grok.GlobalUtility):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r8702 r8703  
    3636from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase
    3737from waeup.kofa.app import University
     38from waeup.kofa.payments.interfaces import IPaymentWebservice
    3839from waeup.kofa.students.student import Student
    3940from waeup.kofa.students.studylevel import StudentStudyLevel
     
    14731474        self.assertEqual(self.student['payments'][value].p_level, 200)
    14741475
    1475         # Student is owner of the payment ticket.
    1476         self.assertEqual(self.student['payments'][value].getOwner(), self.student)
     1476        # Student is the payee of the payment ticket.
     1477        self.assertEqual(IPaymentWebservice(
     1478            self.student['payments'][value]).payee, 'Anna Tester')
    14771479
    14781480        # We simulate the approval
Note: See TracChangeset for help on using the changeset viewer.