Changeset 6781 for main/waeup.sirp/trunk/src
- Timestamp:
- 16 Sep 2011, 08:26:25 (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/interfaces.py
r6775 r6781 207 207 """ 208 208 level = Attribute('The level code') 209 level_title = Attribute('Title of level') 209 210 211 class ICourseTicket(IWAeUPObject): 212 """A course ticket. 213 214 """ 215 code = Attribute('Course code') 216 title = Attribute('Course title') 217 course_level = Attribute('level of the original course referrer') 218 core_or_elective = Attribute('core_or_elective of the original course referrer') 219 220 credits = schema.Int( 221 title = u'Credits', 222 default = 0, 223 required = False, 224 readonly = False, 225 ) 226 227 score = schema.Int( 228 title = u'Score', 229 default = 0, 230 required = False, 231 readonly = False, 232 ) 233 234 grade = schema.TextLine( 235 title = u'Grade', 236 default = u'', 237 required = False, 238 readonly = True, 239 ) 210 240 211 241 class IStudentAccommodation(IWAeUPObject): -
main/waeup.sirp/trunk/src/waeup/sirp/students/studylevel.py
r6775 r6781 22 22 from zope.component.interfaces import IFactory 23 23 from waeup.sirp.students.interfaces import ( 24 IStudentStudyLevel, IStudentNavigation )24 IStudentStudyLevel, IStudentNavigation, ICourseTicket) 25 25 from waeup.sirp.utils.helpers import attrs_to_fields 26 26 from waeup.sirp.students.vocabularies import StudyLevelSource … … 45 45 return studylevelsource.factory.getTitle(self.__parent__, self.level) 46 46 47 def addCourseTicket(self, courseticket): 48 """Add a course ticket object. 49 """ 50 if not ICourseTicket.providedBy(courseticket): 51 raise TypeError( 52 'StudentStudyLeves contain only ICourseTicket instances') 53 self[str(courseticket.code)] = courseticket 54 return 55 47 56 StudentStudyLevel = attrs_to_fields(StudentStudyLevel) 57 58 class CourseTicket(grok.Model): 59 """This is a course ticket which allows the 60 student to attend the course. Lecturers will enter scores and more at 61 the end of the term. 62 """ 63 grok.implements(ICourseTicket, IStudentNavigation) 64 grok.provides(ICourseTicket) 65 66 def __init__(self, code, title, course_level, core_or_elective): 67 super(CourseTicket, self).__init__() 68 self.title = title 69 self.code = code 70 self.course_level = course_level 71 self.core_or_elective = core_or_elective 72 return 73 74 def getStudent(self): 75 return self.__parent__.__parent__.__parent__ 76 77 CourseTicket = attrs_to_fields(CourseTicket) -
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_student.py
r6752 r6781 20 20 from waeup.sirp.students.student import Student, StudentFactory 21 21 from waeup.sirp.students.studycourse import StudentStudyCourse 22 from waeup.sirp.students.studylevel import StudentStudyLevel, CourseTicket 22 23 from waeup.sirp.students.payments import StudentPayments 23 24 from waeup.sirp.students.accommodation import StudentAccommodation 24 25 from waeup.sirp.students.interfaces import ( 25 26 IStudent, IStudentStudyCourse, IStudentPayments, IStudentAccommodation, 26 )27 IStudentStudyLevel, ICourseTicket) 27 28 from waeup.sirp.testing import FunctionalLayer, FunctionalTestCase 28 29 … … 35 36 self.student = Student() 36 37 self.studycourse = StudentStudyCourse() 38 self.studylevel = StudentStudyLevel() 39 self.courseticket = CourseTicket('CERT', 'Title', 100, True) 37 40 self.payments = StudentPayments() 38 41 self.accommodation = StudentAccommodation() … … 48 51 verify.verifyClass(IStudentStudyCourse, StudentStudyCourse) 49 52 verify.verifyObject(IStudentStudyCourse, self.studycourse) 53 verify.verifyObject(IStudentStudyLevel, self.studylevel) 54 verify.verifyObject(ICourseTicket, self.courseticket) 50 55 verify.verifyClass(IStudentPayments, StudentPayments) 51 56 verify.verifyObject(IStudentPayments, self.payments)
Note: See TracChangeset for help on using the changeset viewer.