Last change
on this file since 11105 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 | """ |
---|
3 | import grok |
---|
4 | from zope.interface import implementedBy |
---|
5 | from zope.component.interfaces import IFactory |
---|
6 | from waeup.sirp.university.interfaces import ICourse |
---|
7 | |
---|
8 | class 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 | |
---|
28 | class 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.