Changeset 4259 for waeup


Ignore:
Timestamp:
12 Jun 2009, 08:54:16 (15 years ago)
Author:
uli
Message:

Basic implementation of a course.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/university/course.py

    r3526 r4259  
     1"""Courses.
     2"""
     3import grok
     4from zope.interface import implementedBy
     5from zope.component.interfaces import IFactory
     6from waeup.interfaces import ICourse
     7
     8class Course(grok.Model):
     9    grok.implements(ICourse)
     10
     11    def __init__(self,
     12                 title=u'Unnamed Course',
     13                 code=u'NA', **kw):
     14        super(Course, self).__init__(**kw)
     15        self.title = title
     16        self.code = code
     17       
     18class CourseFactory(grok.GlobalUtility):
     19    """A factory for courses.
     20    """
     21    grok.implements(IFactory)
     22    grok.name(u'waeup.Course')
     23    title = u"Create a new course.",
     24    description = u"This factory instantiates new course instances."
     25
     26    def __call__(self):
     27        return Course()
     28
     29    def getInterfaces(self):
     30        return implementedBy(Course)
Note: See TracChangeset for help on using the changeset viewer.