Last change
on this file since 5956 was
5953,
checked in by uli, 14 years ago
|
Let models implement also the appropriate I...Add interfaces.
|
-
Property svn:eol-style set to
native
|
File size:
1.0 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, ICourseAdd |
---|
7 | |
---|
8 | class 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 | class CourseFactory(grok.GlobalUtility): |
---|
27 | """A factory for courses. |
---|
28 | """ |
---|
29 | grok.implements(IFactory) |
---|
30 | grok.name(u'waeup.Course') |
---|
31 | title = u"Create a new course.", |
---|
32 | description = u"This factory instantiates new course instances." |
---|
33 | |
---|
34 | def __call__(self, *args, **kw): |
---|
35 | return Course(*args, **kw) |
---|
36 | |
---|
37 | def getInterfaces(self): |
---|
38 | return implementedBy(Course) |
---|
Note: See
TracBrowser for help on using the repository browser.