source: main/waeup.kofa/trunk/src/waeup/kofa/university/department.txt @ 10642

Last change on this file since 10642 was 7819, checked in by Henrik Bettermann, 13 years ago

KOFA -> Kofa

File size: 3.7 KB
RevLine 
[7811]1:mod:`waeup.kofa.university.department` -- Departments
[4920]2******************************************************
[4252]3
[7811]4.. module:: waeup.kofa.university.department
[4326]5
6Components that represent university departments.
7
[5140]8.. :doctest:
[7819]9.. :layer: waeup.kofa.testing.KofaUnitTestLayer
[4252]10
[4326]11Content Classes (models and containers)
12=======================================
[4252]13
14
[4326]15:class:`Department`
16-------------------
[4252]17
[4326]18.. class:: Department(title=u'Unnamed Department'[, title_prefix=u'department' [, code=u"NA"]])
[4252]19
[4326]20   Create a representation of a university department:
[4252]21
[7811]22     >>> from waeup.kofa.university.department import Department
[4326]23     >>> mydept = Department()
24     >>> mydept
[7811]25     <waeup.kofa.university.department.Department object at 0x...>
[4252]26
[4326]27   Another way to create :class:`Department` instances is by asking
[7811]28   for a factory called ``waeup.kofa.Department``. This way we can create a
[4326]29   department without importing a class:
[4252]30
[4326]31     >>> from zope.component import createObject
32     >>> mydept = createObject(u'waeup.Department')
33     >>> mydept
[7811]34     <waeup.kofa.university.department.Department object at 0x...>
[4252]35
[4326]36   :class:`Department` instances have the attributes required by the
37   `IDepartment` interface:
[4252]38
[7811]39     >>> from waeup.kofa.university.interfaces import IDepartment
[4326]40     >>> IDepartment.providedBy(mydept)
41     True
[4252]42
[4326]43     >>> from zope.interface.verify import verifyObject
44     >>> verifyObject(IDepartment, mydept)
45     True
[4252]46
47
[4326]48   .. attribute:: title
[4252]49
[4326]50      (string) The title of a department.
[4252]51
[4326]52      Each department has a title:
[4252]53
[4326]54        >>> mydept.title
55        u'Unnamed Department'
[4252]56
[4258]57
[4326]58   .. attribute:: title_prefix
[4258]59
[4326]60      (string) The prefix of a department.
[4258]61
[4326]62      Each department has a title prefix, which specifies the kind of
63      institution:
64
65        >>> mydept.title_prefix
66        u'department'
67
68
69   .. attribute:: code
70
71      (string) An internally used unique code string.
72
73      Each department holds a code, which might be a shortcut or
74      abbreviation of the real department name. By default the code is
75      ``NA`` (=not assigned):
76
77        >>> mydept.code
78        u'NA'
79
80
81   .. attribute:: courses
82
[7333]83      (ICoursesContainer instance) A container for courses.
[4326]84
85      Each department has a courses container:
86
87        >>> mydept.courses
[7811]88        <waeup.kofa.university.coursescontainer.CoursesContainer object at 0x...>
[4326]89
[4327]90
91   .. attribute:: certificates
92
[7333]93      (ICertificatesContainer instance) A container for certificates.
[4327]94
95      Each department has a certificate container, that holds the
96      descrtiptions of certificates the department has:
97
98        >>> mydept.certificates
[7811]99        <waeup.kofa...certificatescontainer.CertificatesContainer object at 0x...>
[4327]100
[4372]101Utilities
102=========
103
104:class:`DepartmentFactory`
105--------------------------
106
107.. class:: DepartmentFactory()
108
109   .. attribute:: grok.name(u'waeup.Department')
110
111   .. attribute:: grok.implements(IFactory)
112
113   A named utility to deliver new instances of :class:`Department`
114   without the need to import the implementation before:
115
116     >>> from zope.component import createObject
117     >>> mydepartment = createObject(u'waeup.Department')
118     >>> mydepartment
[7811]119     <waeup.kofa.university.department.Department object at 0x...>
[4372]120
121   The factory complies with the specifications from the
122   :class:`IFactory` insterface:
123
124     >>> from zope.interface.verify import verifyClass
125     >>> from zope.component.interfaces import IFactory
[7811]126     >>> from waeup.kofa.university.department import DepartmentFactory
[4372]127     >>> verifyClass(IFactory, DepartmentFactory)
128     True
129
130   This means also, that we can get the interfaces of the created
131   object from the factory:
132
133     >>> department_factory = DepartmentFactory()
134     >>> department_factory.getInterfaces()
[7811]135     <implementedBy waeup.kofa.university.department.Department>
Note: See TracBrowser for help on using the repository browser.