- Timestamp:
- 14 Jun 2009, 16:36:21 (16 years ago)
- Location:
- waeup/branches/ulif-rewrite/src/waeup/university
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/university/certificate.py
r4281 r4289 10 10 grok.implements(ICertificate) 11 11 12 def __init__(self, code='NA'): 12 def __init__(self, code='NA', title='Unnamed', level=None, 13 credits = 0, passmark=40, semester=1): 13 14 self.code = code 15 self.title = title 16 self.level = level 17 self.credits = credits 18 self.passmark = passmark 19 self.semester = semester 14 20 15 class CertificateContainer(grok.Container): 16 """See interfaces for description. 17 """ 18 grok.implements(ICertificateContainer) 19 grok.require('waeup.manageUniversity') 20 21 def addCertificate(self, certificate): 22 if not ICertificate.providedBy(certificate): 23 raise TypeError('CertificateContainers contain only ' 24 'ICertificate instances') 25 self[certificate.code] = certificate 26 return 27 28 def clear(self): 29 keys = self.keys() 30 for key in keys: 31 del self[key] 32 33 class CertificateContainerFactory(grok.GlobalUtility): 34 """A factory for certificate containers. 21 class CertificateFactory(grok.GlobalUtility): 22 """A factory for certificates. 35 23 """ 36 24 grok.implements(IFactory) 37 grok.name(u'waeup.Certificate Container')38 title = u"Create a new certificate container.",39 description = u"This factory instantiates new certificate containers."25 grok.name(u'waeup.Certificate') 26 title = u"Create a new certificate.", 27 description = u"This factory instantiates new certificate instances." 40 28 41 29 def __call__(self): 42 return Certificate Container()30 return Certificate() 43 31 44 32 def getInterfaces(self): 45 return implementedBy(Certificate Container)33 return implementedBy(Certificate)
Note: See TracChangeset for help on using the changeset viewer.