Changeset 9987


Ignore:
Timestamp:
24 Feb 2013, 11:15:47 (12 years ago)
Author:
Henrik Bettermann
Message:

Put logic of customization of display_item and display_bedcoordinates into global utility methods. This simplifies customization.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
4 edited

Legend:

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

    r9984 r9987  
    6767    @property
    6868    def display_item(self):
    69         return self.p_item
     69        kofa_utils = getUtility(IKofaUtils)
     70        return kofa_utils.getPaymentItem(self)
    7071
    7172class OnlinePayment(Payment):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/accommodation.py

    r9984 r9987  
    2626from waeup.kofa.interfaces import academic_sessions_vocab, IKofaUtils
    2727from waeup.kofa.students.interfaces import (
    28     IStudentAccommodation, IStudentNavigation, IBedTicket)
     28    IStudentAccommodation, IStudentNavigation, IBedTicket, IStudentsUtils)
    2929from waeup.kofa.utils.helpers import attrs_to_fields
    3030
     
    7878    @property
    7979    def display_coordinates(self):
    80         return self.bed_coordinates
     80        students_utils = getUtility(IStudentsUtils)
     81        return students_utils.getBedCoordinates(self)
    8182
    8283    def writeLogMessage(self, view, message):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r9981 r9987  
    649649        return 0
    650650
     651    def getBedCoordinates(self, bedticket):
     652        """Return bed coordinates.
     653
     654        This method can be used to customize the display_coordinates
     655        property method.
     656        """
     657        return bedticket.bed_coordinates
     658
    651659    VERDICTS_DICT = {
    652660        '0': _('(not yet)'),
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py

    r9868 r9987  
    271271        return send_mail(
    272272            from_name,from_addr,rcpt_name,rcpt_addr,subject,body,config)
     273
     274    def getPaymentItem(self, payment):
     275        """Return payment item.
     276
     277        This method can be used to customize the display_item property method.
     278        """
     279        return payment.p_item
Note: See TracChangeset for help on using the changeset viewer.