source: main/waeup.sirp/trunk/src/waeup/sirp/university/course.py @ 6940

Last change on this file since 6940 was 6566, checked in by uli, 13 years ago

Remove trailing whitespaces.

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1"""Courses.
2"""
3import grok
4from zope.interface import implementedBy
5from zope.component.interfaces import IFactory
6from waeup.sirp.university.interfaces import ICourse, ICourseAdd
7
8class Course(grok.Model):
9    """A university course.
10    """
11    grok.implements(ICourse, ICourseAdd)
12
13    def __init__(self,
14                 title=u'Unnamed Course',
15                 code=u'NA',
16                 credits=0,
17                 passmark=40,
18                 semester=1, **kw):
19        super(Course, self).__init__(**kw)
20        self.title = title
21        self.code = code
22        self.credits = credits
23        self.passmark = passmark
24        self.semester = semester
25
26    def longtitle(self):
27        return "%s (%s)" % (self.title,self.code)
28
29class CourseFactory(grok.GlobalUtility):
30    """A factory for courses.
31    """
32    grok.implements(IFactory)
33    grok.name(u'waeup.Course')
34    title = u"Create a new course.",
35    description = u"This factory instantiates new course instances."
36
37    def __call__(self, *args, **kw):
38        return Course(*args, **kw)
39
40    def getInterfaces(self):
41        return implementedBy(Course)
Note: See TracBrowser for help on using the repository browser.