:mod:`waeup.app` -- central components for a WAeUP portal ********************************************************* :Test-Layer: unit .. module:: waeup.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.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: >>> import grok >>> grok.testing.grok('waeup') Now we can import the :class:`University` class and create an instance: >>> from waeup.app import University >>> myuniversity = University() >>> myuniversity Instances of `University` comply with the interface `waeup.interfaces.IUniversity`: >>> from zope.interface.verify import verifyClass >>> from waeup.interfaces import IUniversity >>> verifyClass(IUniversity, University) True A freshly created instance provides the attributes promised by the interface: >>> from waeup.app import University >>> myuniversity = University() >>> myuniversity.name u'Sample University' >>> myuniversity.faculties