Ignore:
Timestamp:
14 Jun 2009, 16:36:21 (15 years ago)
Author:
uli
Message:

Split certificate and certificatecontainer.

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  
    1010    grok.implements(ICertificate)
    1111
    12     def __init__(self, code='NA'):
     12    def __init__(self, code='NA', title='Unnamed', level=None,
     13                 credits = 0, passmark=40, semester=1):
    1314        self.code = code
     15        self.title = title
     16        self.level = level
     17        self.credits = credits
     18        self.passmark = passmark
     19        self.semester = semester
    1420
    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.
     21class CertificateFactory(grok.GlobalUtility):
     22    """A factory for certificates.
    3523    """
    3624    grok.implements(IFactory)
    37     grok.name(u'waeup.CertificateContainer')
    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."
    4028
    4129    def __call__(self):
    42         return CertificateContainer()
     30        return Certificate()
    4331
    4432    def getInterfaces(self):
    45         return implementedBy(CertificateContainer)
     33        return implementedBy(Certificate)
Note: See TracChangeset for help on using the changeset viewer.