Changeset 6989 for main


Ignore:
Timestamp:
2 Nov 2011, 12:18:49 (13 years ago)
Author:
Henrik Bettermann
Message:

Initialze bed ticket system.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/students
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/accommodation.py

    r6642 r6989  
    2121from zope.component.interfaces import IFactory
    2222from waeup.sirp.students.interfaces import (
    23     IStudentAccommodation, IStudentNavigation)
     23    IStudentAccommodation, IStudentNavigation, IBedTicket)
    2424from waeup.sirp.utils.helpers import attrs_to_fields
    2525
     
    3434        return
    3535
     36    def addBedTicket(self, bedticket):
     37        """Add a bed ticket object.
     38        """
     39        if not IBedTicket.providedBy(bedticket):
     40            raise TypeError(
     41                'StudentAccommodation containers contain only IBedTicket instances')
     42        self[bedticket.ticket_id] = bedticket
     43        return
     44
    3645    def getStudent(self):
    3746        return self.__parent__
    3847
    3948StudentAccommodation = attrs_to_fields(StudentAccommodation)
     49
     50class BedTicket(grok.Model):
     51    """This is a bed ticket which shows that the student has booked a bed
     52    and paid the maintenance fee.
     53    """
     54    grok.implements(IBedTicket, IStudentNavigation)
     55    grok.provides(IBedTicket)
     56
     57    def __init__(self):
     58        super(BedTicket, self).__init__()
     59        return
     60
     61    def getStudent(self):
     62        return self.__parent__.__parent__
     63
     64BedTicket = attrs_to_fields(BedTicket)
  • main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py

    r6935 r6989  
    315315    """
    316316
     317class IBedTicket(IWAeUPObject):
     318    """A ticket for accommodation booking.
     319
     320    """
     321
    317322class IStudentPaymentsContainer(IPaymentsContainer):
    318323    """A container for student payment objects.
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_student.py

    r6859 r6989  
    2222from waeup.sirp.students.studylevel import StudentStudyLevel, CourseTicket
    2323from waeup.sirp.students.payments import StudentPaymentsContainer
    24 from waeup.sirp.students.accommodation import StudentAccommodation
     24from waeup.sirp.students.accommodation import StudentAccommodation, BedTicket
    2525from waeup.sirp.students.interfaces import (
    2626    IStudent, IStudentStudyCourse, IStudentPaymentsContainer, IStudentAccommodation,
    27     IStudentStudyLevel, ICourseTicket)
     27    IStudentStudyLevel, ICourseTicket, IBedTicket)
    2828from waeup.sirp.testing import FunctionalLayer, FunctionalTestCase
    2929
     
    4040        self.payments = StudentPaymentsContainer()
    4141        self.accommodation = StudentAccommodation()
     42        self.bedticket = BedTicket()
    4243        return
    4344
     
    5758        verify.verifyClass(IStudentAccommodation, StudentAccommodation)
    5859        verify.verifyObject(IStudentAccommodation, self.accommodation)
     60        verify.verifyClass(IBedTicket, BedTicket)
     61        verify.verifyObject(IBedTicket, self.bedticket)
    5962        return
    6063
Note: See TracChangeset for help on using the changeset viewer.