:mod:`waeup.sirp.app` -- central components for a WAeUP portal
**************************************************************

.. :doctest:
.. :layer: waeup.sirp.testing.WAeUPSIRPUnitTestLayer

.. module:: waeup.sirp.app

.. class:: University

  The main WAeUP application object is given with
  :class:`University`. It provides the main containers as faculties,
  hostels, etc.

  .. attribute:: name

     A string. The name of a university.

  .. attribute:: faculties

     An arbitrary object containing "faculties". In the case of
     `University` it is a container of type
     `waeup.sirp.interfaces.IFacultyContainer`.


Creating `University` instances
===============================

As :class:`University` instances make use of the Zope Component
Architecture (ZCA), we have to setup the basic component registries,
before we can create instances. We do this by simply grokking the
whole :mod:`waeup` package. This way all interfaces, utilities and adapters
defined in the package are looked up and registered with the global
registries (this is done by the testlayer automatically).

Now we can import the :class:`University` class and create an
instance:

    >>> from waeup.sirp.app import University
    >>> myuniversity = University()
    >>> myuniversity
    <waeup.sirp.app.University object at 0x...>

Instances of `University` comply with the interface
`waeup.sirp.interfaces.IUniversity`:

    >>> from zope.interface.verify import verifyClass
    >>> from waeup.sirp.interfaces import IUniversity
    >>> verifyClass(IUniversity, University)
    True

A freshly created instance provides the attributes promised by the
interface:

    >>> from waeup.sirp.app import University
    >>> myuniversity = University()
    >>> myuniversity.name
    u'Sample University'

    >>> myuniversity['faculties']
    <waeup.sirp.university.facultycontainer.FacultyContainer object at 0x...>
