Changeset 14353


Ignore:
Timestamp:
16 Dec 2016, 11:52:34 (8 years ago)
Author:
Henrik Bettermann
Message:

Start customization of addCourseTicket.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/students/studylevel.py

    r10481 r14353  
    2727    StudentStudyLevel, CourseTicket,
    2828    CourseTicketFactory, StudentStudyLevelFactory)
    29 from waeup.kofa.students.interfaces import IStudentNavigation
     29from waeup.kofa.students.interfaces import IStudentNavigation, ICourseTicket
    3030from waeup.uniben.students.interfaces import (
    3131    ICustomStudentStudyLevel, ICustomCourseTicket)
     
    3737    grok.implements(ICustomStudentStudyLevel, IStudentNavigation)
    3838    grok.provides(ICustomStudentStudyLevel)
     39
     40    def addCourseTicket(self, ticket, course):
     41        """Add a course ticket object.
     42        """
     43        if not ICourseTicket.providedBy(ticket):
     44            raise TypeError(
     45                'StudentStudyLeves contain only ICourseTicket instances')
     46        ticket.code = course.code
     47        ticket.title = course.title
     48        ticket.fcode = course.__parent__.__parent__.__parent__.code
     49        ticket.dcode = course.__parent__.__parent__.code
     50        ticket.credits = course.credits
     51        ticket.passmark = course.passmark
     52        ticket.semester = course.semester
     53        self[ticket.code] = ticket
     54        return
    3955
    4056CustomStudentStudyLevel = attrs_to_fields(
Note: See TracChangeset for help on using the changeset viewer.