Changeset 4081


Ignore:
Timestamp:
25 Apr 2009, 13:45:14 (16 years ago)
Author:
uli
Message:

Make a real factory for HostelContainers?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/hostel/hostelcontainer.py

    r3942 r4081  
    11import grok
     2from zope.component.interfaces import IFactory
     3from zope.interface import implementedBy
    24from waeup.interfaces import IHostelContainer, IHostel
    35from waeup.viewlets import MainArea, Index, Add, FormWrapMixin
     
    2123        return id
    2224
     25class HostelContainerFactory(grok.GlobalUtility):
     26    """A factory for faculty containers.
     27    """
     28    grok.implements(IFactory)
     29    grok.name(u'waeup.HostelContainer')
     30    title = u"Create a new hostel container.",
     31    description = u"This factory instantiates new hostel containers."
    2332
    24 # We register HostelContainer as a utility. This way we can
    25 # call getUtility(IHostelContainer) from anywhere in the code and
    26 # get an instance of HostelContainer (without importing it).
    27 grok.global_utility(HostelContainer, provides=IHostelContainer)
     33    def __call__(self):
     34        return HostelContainer()
     35
     36    def getInterfaces(self):
     37        return implementedBy(HostelContainer)
     38
    2839
    2940class AddHostelForm(grok.AddForm):
Note: See TracChangeset for help on using the changeset viewer.