university.certificatescontainer - Certificates Container Components¶
Containers for certificates.
-
class
waeup.kofa.university.certificatescontainer.
CertificatesContainer
[source]¶ Bases:
grokcore.content.components.Container
A storage for certificates.
A
CertificatesContainer
storeswaeup.kofa.university.Certificate
instances.It is a
grok.Container
basically acting like a standard Python dictionary. That means you can add certificates like items in a normal dictionary and also get certificates by usingvalues()
,keys()
, anditems()
.This container type is picky about its contents: only real certificates can be stored here and each new certificate must provide a unique code. See
addCertificate()
for details.Each
CertificatesContainer
providesICertificatesContainer
.-
__doc__
= 'A storage for certificates.\n\n A :class:`CertificatesContainer` stores\n :class:`waeup.kofa.university.Certificate` instances.\n\n It is a :class:`grok.Container` basically acting like a standard\n Python dictionary. That means you can add certificates like items\n in a normal dictionary and also get certificates by using\n :meth:`values`, :meth:`keys`, and :meth:`items`.\n\n This container type is picky about its contents: only real\n certificates can be stored here and each new certificate must\n provide a unique `code`. See :meth:`addCertificate` for details.\n\n Each :class:`CertificatesContainer` provides\n :class:`ICertificatesContainer`.\n '¶
-
__implemented__
= <implementedBy waeup.kofa.university.certificatescontainer.CertificatesContainer>¶
-
__module__
= 'waeup.kofa.university.certificatescontainer'¶
-
__provides__
¶ Special descriptor for class __provides__
The descriptor caches the implementedBy info, so that we can get declarations for objects without instance-specific interfaces a bit quicker.
For example:
>>> from zope.interface import Interface >>> class IFooFactory(Interface): ... pass >>> class IFoo(Interface): ... pass >>> class C(object): ... implements(IFoo) ... classProvides(IFooFactory) >>> [i.getName() for i in C.__provides__] ['IFooFactory']
>>> [i.getName() for i in C().__provides__] ['IFoo']
-
__setitem__
(name, certificate)[source]¶ Insert certificate with name as key into container.
The certificate must be an object implementing
waeup.kofa.university.interfaces.ICertificate
. If not, aTypeError
is raised.If the certificate code does not equal name a
ValueError
is raised.If the code attribute of certificate is already in use by another certificate stored in the local site (
waeup.kofa.app.University
instance), then awaeup.kofa.interfaces.DuplicationError
will be raised.If name is already used as a key, a
KeyError
will be raised.
-
addCertificate
(certificate)[source]¶ Add certificate to the container.
The certificate must be an object implementing
waeup.kofa.university.interfaces.ICertificate
. If not, aTypeError
is raised.The certificate will be stored in the container with its code attribute as key. If this key is already used for another certificate stored in the local site (
waeup.kofa.app.University
instance), then awaeup.kofa.interfaces.DuplicationError
will be raised.
-
-
class
waeup.kofa.university.certificatescontainer.
CertificatesContainerFactory
[source]¶ Bases:
grokcore.component.components.GlobalUtility
A factory for certificate containers.
-
__doc__
= 'A factory for certificate containers.\n '¶
-
__implemented__
= <implementedBy waeup.kofa.university.certificatescontainer.CertificatesContainerFactory>¶
-
__module__
= 'waeup.kofa.university.certificatescontainer'¶
-
__provides__
¶ Special descriptor for class __provides__
The descriptor caches the implementedBy info, so that we can get declarations for objects without instance-specific interfaces a bit quicker.
For example:
>>> from zope.interface import Interface >>> class IFooFactory(Interface): ... pass >>> class IFoo(Interface): ... pass >>> class C(object): ... implements(IFoo) ... classProvides(IFooFactory) >>> [i.getName() for i in C.__provides__] ['IFooFactory']
>>> [i.getName() for i in C().__provides__] ['IFoo']
-
description
= u'This factory instantiates new containers for certificates.'¶
-
title
= (u'Create a new container for certificates.',)¶
-