source: main/waeup.sirp/trunk/src/waeup/sirp/university/department.txt @ 6101

Last change on this file since 6101 was 5140, checked in by uli, 15 years ago

Update all unit tests that use the ZCA to run inside the new unit test layer.

File size: 3.7 KB
Line 
1:mod:`waeup.sirp.university.department` -- Departments
2******************************************************
3
4.. module:: waeup.sirp.university.department
5
6Components that represent university departments.
7
8.. :doctest:
9.. :layer: waeup.sirp.testing.WAeUPSIRPUnitTestLayer
10
11Content Classes (models and containers)
12=======================================
13
14
15:class:`Department`
16-------------------
17
18.. class:: Department(title=u'Unnamed Department'[, title_prefix=u'department' [, code=u"NA"]])
19
20   Create a representation of a university department:
21
22     >>> from waeup.sirp.university.department import Department
23     >>> mydept = Department()
24     >>> mydept
25     <waeup.sirp.university.department.Department object at 0x...>
26
27   Another way to create :class:`Department` instances is by asking
28   for a factory called ``waeup.sirp.Department``. This way we can create a
29   department without importing a class:
30
31     >>> from zope.component import createObject
32     >>> mydept = createObject(u'waeup.Department')
33     >>> mydept
34     <waeup.sirp.university.department.Department object at 0x...>
35
36   :class:`Department` instances have the attributes required by the
37   `IDepartment` interface:
38
39     >>> from waeup.sirp.university.interfaces import IDepartment
40     >>> IDepartment.providedBy(mydept)
41     True
42
43     >>> from zope.interface.verify import verifyObject
44     >>> verifyObject(IDepartment, mydept)
45     True
46
47
48   .. attribute:: title
49
50      (string) The title of a department.
51
52      Each department has a title:
53
54        >>> mydept.title
55        u'Unnamed Department'
56
57
58   .. attribute:: title_prefix
59
60      (string) The prefix of a department.
61
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
83      (ICourseContainer instance) A container for courses.
84
85      Each department has a courses container:
86
87        >>> mydept.courses
88        <waeup.sirp.university.coursecontainer.CourseContainer object at 0x...>
89
90
91   .. attribute:: certificates
92
93      (ICertificateContainer instance) A container for certificates.
94
95      Each department has a certificate container, that holds the
96      descrtiptions of certificates the department has:
97
98        >>> mydept.certificates
99        <waeup.sirp...certificatecontainer.CertificateContainer object at 0x...>
100
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
119     <waeup.sirp.university.department.Department object at 0x...>
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
126     >>> from waeup.sirp.university.department import DepartmentFactory
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()
135     <implementedBy waeup.sirp.university.department.Department>
Note: See TracBrowser for help on using the repository browser.