source: main/waeup.sirp/trunk/src/waeup/sirp/app.txt @ 5127

Last change on this file since 5127 was 4920, checked in by uli, 15 years ago

Make unit tests run again with the new package layout.

File size: 1.8 KB
Line 
1:mod:`waeup.sirp.app` -- central components for a WAeUP portal
2**************************************************************
3
4:Test-Layer: unit
5
6.. module:: waeup.sirp.app
7
8.. class:: University
9
10  The main WAeUP application object is given with
11  :class:`University`. It provides the main containers as faculties,
12  hostels, etc.
13
14  .. attribute:: name
15
16     A string. The name of a university.
17
18  .. attribute:: faculties
19
20     An arbitrary object containing "faculties". In the case of
21     `University` it is a container of type
22     `waeup.sirp.interfaces.IFacultyContainer`.
23
24
25Creating `University` instances
26===============================
27
28As :class:`University` instances make use of the Zope Component
29Architecture (ZCA), we have to setup the basic component registries,
30before we can create instances. We do this by simply grokking the
31whole :mod:`waeup` package. This way all interfaces, utilities and adapters
32defined in the package are looked up and registered with the global
33registries:
34
35    >>> import grok
36    >>> grok.testing.grok('waeup')
37
38Now we can import the :class:`University` class and create an
39instance:
40
41    >>> from waeup.sirp.app import University
42    >>> myuniversity = University()
43    >>> myuniversity
44    <waeup.sirp.app.University object at 0x...>
45
46Instances of `University` comply with the interface
47`waeup.sirp.interfaces.IUniversity`:
48
49    >>> from zope.interface.verify import verifyClass
50    >>> from waeup.sirp.interfaces import IUniversity
51    >>> verifyClass(IUniversity, University)
52    True
53
54A freshly created instance provides the attributes promised by the
55interface:
56
57    >>> from waeup.sirp.app import University
58    >>> myuniversity = University()
59    >>> myuniversity.name
60    u'Sample University'
61
62    >>> myuniversity['faculties']
63    <waeup.sirp.university.facultycontainer.FacultyContainer object at 0x...>
Note: See TracBrowser for help on using the repository browser.