Changeset 6989 for main/waeup.sirp/trunk/src/waeup/sirp
- Timestamp:
- 2 Nov 2011, 12:18:49 (13 years ago)
- 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 21 21 from zope.component.interfaces import IFactory 22 22 from waeup.sirp.students.interfaces import ( 23 IStudentAccommodation, IStudentNavigation )23 IStudentAccommodation, IStudentNavigation, IBedTicket) 24 24 from waeup.sirp.utils.helpers import attrs_to_fields 25 25 … … 34 34 return 35 35 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 36 45 def getStudent(self): 37 46 return self.__parent__ 38 47 39 48 StudentAccommodation = attrs_to_fields(StudentAccommodation) 49 50 class 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 64 BedTicket = attrs_to_fields(BedTicket) -
main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py
r6935 r6989 315 315 """ 316 316 317 class IBedTicket(IWAeUPObject): 318 """A ticket for accommodation booking. 319 320 """ 321 317 322 class IStudentPaymentsContainer(IPaymentsContainer): 318 323 """A container for student payment objects. -
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_student.py
r6859 r6989 22 22 from waeup.sirp.students.studylevel import StudentStudyLevel, CourseTicket 23 23 from waeup.sirp.students.payments import StudentPaymentsContainer 24 from waeup.sirp.students.accommodation import StudentAccommodation 24 from waeup.sirp.students.accommodation import StudentAccommodation, BedTicket 25 25 from waeup.sirp.students.interfaces import ( 26 26 IStudent, IStudentStudyCourse, IStudentPaymentsContainer, IStudentAccommodation, 27 IStudentStudyLevel, ICourseTicket )27 IStudentStudyLevel, ICourseTicket, IBedTicket) 28 28 from waeup.sirp.testing import FunctionalLayer, FunctionalTestCase 29 29 … … 40 40 self.payments = StudentPaymentsContainer() 41 41 self.accommodation = StudentAccommodation() 42 self.bedticket = BedTicket() 42 43 return 43 44 … … 57 58 verify.verifyClass(IStudentAccommodation, StudentAccommodation) 58 59 verify.verifyObject(IStudentAccommodation, self.accommodation) 60 verify.verifyClass(IBedTicket, BedTicket) 61 verify.verifyObject(IBedTicket, self.bedticket) 59 62 return 60 63
Note: See TracChangeset for help on using the changeset viewer.