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

Last change on this file since 4975 was 4920, checked in by uli, 15 years ago

Make unit tests run again with the new package layout.

  • 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.interfaces import ICourse
7
8class Course(grok.Model):
9    """A university course.
10    """
11    grok.implements(ICourse)
12
13    def __init__(self,
14                 title=u'Unnamed Course',
15                 code=u'NA',
16                 level=None,
17                 credits=0,
18                 passmark=40,
19                 semester=1, **kw):
20        super(Course, self).__init__(**kw)
21        self.title = title
22        self.code = code
23        self.level = level
24        self.credits = credits
25        self.passmark = passmark
26        self.semester = semester
27       
28class CourseFactory(grok.GlobalUtility):
29    """A factory for courses.
30    """
31    grok.implements(IFactory)
32    grok.name(u'waeup.Course')
33    title = u"Create a new course.",
34    description = u"This factory instantiates new course instances."
35
36    def __call__(self, *args, **kw):
37        return Course(*args, **kw)
38
39    def getInterfaces(self):
40        return implementedBy(Course)
Note: See TracBrowser for help on using the repository browser.