source: main/waeup.sirp/branches/ulif-images/src/waeup/sirp/university/course.py @ 10009

Last change on this file since 10009 was 5005, checked in by uli, 15 years ago

Fix references to academics stuff interfaces. This is the first step to make academics stuff pluggable.

  • 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
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.