Last change
on this file since 6146 was
6008,
checked in by Henrik Bettermann, 14 years ago
|
Provide longtitle for all university instances. Use lontitle in breadcrumbs. Show faculty and department on certificatecoursepage.
|
-
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, 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 | def longtitle(self): |
---|
27 | return "%s (%s)" % (self.title,self.code) |
---|
28 | |
---|
29 | class 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.