- Timestamp:
- 16 Dec 2009, 10:37:20 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/interfaces.py
r4512 r4559 1 1 ## 2 2 ## interfaces.py 3 from zc.sourcefactory.basic import BasicSourceFactory 4 from zope.component import getUtility 5 from zope.app.catalog.interfaces import ICatalog 3 6 from zope.interface import Interface, Attribute 4 7 from zope import schema … … 12 15 return SimpleVocabulary([ 13 16 SimpleTerm(value, value, title) for title, value in terms]) 17 18 19 class CourseSource(BasicSourceFactory): 20 """A course source delivers all courses inside the portal by looking 21 up a catalog. 22 """ 23 catalog = None 24 def getValues(self): 25 if self.catalog is None: 26 self.catalog = getUtility(ICatalog, name='courses_catalog') 27 result = list(self.catalog.searchResults(code=('', 'z*'))) 28 29 def getTitle(self, value): 30 return "%s %s" % (value.code, value.title[:32]) 31 14 32 15 33 class IWAeUPObject(Interface): … … 228 246 229 247 248 230 249 class ICertificateContainer(IWAeUPContainer): 231 250 """A container for certificates. … … 238 257 239 258 class ICertificateCourse(IWAeUPObject): 240 """A course as part of a certificate. 241 """ 242 course = Attribute("A course instance.") 243 259 """A certificatecourse is a course referenced by a certificate, which 260 provides some own attributes. 261 """ 262 course = schema.Choice( 263 title = u'Course', 264 source = CourseSource(), 265 ) 266 244 267 level = schema.Int( 245 268 title = u'Level of this course',
Note: See TracChangeset for help on using the changeset viewer.