Changeset 5016 for main/waeup.sirp


Ignore:
Timestamp:
4 Feb 2010, 17:55:34 (15 years ago)
Author:
uli
Message:

Stop hardcoding of creation of faculties. Use plugin mechanism
instead.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/app.py

    r4968 r5016  
    44from zope.app.authentication.authentication import PluggableAuthentication
    55from zope.app.security.interfaces import IAuthentication
    6 from zope.component import createObject
     6from zope.component import createObject, getAllUtilitiesRegisteredFor
    77
    8 from waeup.sirp.interfaces import (IUniversity, IDataCenter,
    9                                    IDataCenterStorageMovedEvent)
     8from waeup.sirp.interfaces import (
     9    IUniversity, IDataCenter, IWAeUPSIRPPluggable,
     10    IDataCenterStorageMovedEvent)
    1011from waeup.sirp.authentication import setup_authentication
    1112from waeup.sirp.datacenter import DataCenter
     
    3839
    3940    def setup(self):
    40         self['students'] = createObject(u'waeup.StudentContainer')
    41         self['hostels'] = createObject(u'waeup.HostelContainer')
    42         self['faculties'] = createObject(u'waeup.FacultyContainer')
    4341        self['users'] = UserContainer()
    4442        self['datacenter'] = DataCenter()
    4543
     44        self['students'] = createObject(u'waeup.StudentContainer')
     45        self['hostels'] = createObject(u'waeup.HostelContainer')
     46        self._createPlugins()
     47
     48    def _createPlugins(self):
     49        """Create instances of all plugins defined somewhere.
     50        """
     51        plugins = getAllUtilitiesRegisteredFor(IWAeUPSIRPPluggable)
     52        for plugin in plugins:
     53            self[plugin.name] = createObject(plugin.factory_name)
     54       
    4655    def _setupLogger(self, logger):
    4756        """Setup general application logger.
Note: See TracChangeset for help on using the changeset viewer.