source: waeup/trunk/src/waeup/app.txt @ 4916

Last change on this file since 4916 was 4789, checked in by uli, 15 years ago

Merge changes from ulif-layout back into trunk (finally).

File size: 1.8 KB
RevLine 
[4273]1:mod:`waeup.app` -- central components for a WAeUP portal
2*********************************************************
[3933]3
4:Test-Layer: unit
5
[4273]6.. module:: waeup.app
[3933]7
[4273]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.interfaces.IFacultyContainer`.
23
24
[3933]25Creating `University` instances
26===============================
27
[4273]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:
[3933]34
35    >>> import grok
36    >>> grok.testing.grok('waeup')
37
[4273]38Now we can import the :class:`University` class and create an
39instance:
[3933]40
41    >>> from waeup.app import University
42    >>> myuniversity = University()
43    >>> myuniversity
44    <waeup.app.University object at 0x...>
45
46Instances of `University` comply with the interface
[4273]47`waeup.interfaces.IUniversity`:
[3933]48
49    >>> from zope.interface.verify import verifyClass
50    >>> from waeup.interfaces import IUniversity
51    >>> verifyClass(IUniversity, University)
52    True
53
[4273]54A freshly created instance provides the attributes promised by the
55interface:
[3933]56
57    >>> from waeup.app import University
58    >>> myuniversity = University()
59    >>> myuniversity.name
60    u'Sample University'
61
[4748]62    >>> myuniversity['faculties']
[3933]63    <waeup.university.facultycontainer.FacultyContainer object at 0x...>
Note: See TracBrowser for help on using the repository browser.