Changeset 4156


Ignore:
Timestamp:
24 May 2009, 09:33:55 (16 years ago)
Author:
uli
Message:

Provide a real factory for faculties.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/university/faculty.py

    r4138 r4156  
    11import grok
     2from zope.component.interfaces import IFactory
    23from waeup.interfaces import IFaculty
    34from waeup.viewlets import MainArea, LeftSidebar, Index, FormWrapMixin, Manage
     
    67    grok.implements(IFaculty)
    78
    8     def __init__(self, name=u'Unnamed Faculty', **kw):
     9    def __init__(self,
     10                 title=u'Unnamed Faculty',
     11                 title_prefix=u'faculty',
     12                 code=None, **kw):
    913        super(Faculty, self).__init__(**kw)
    10         self.name = name
     14        self.title = title
     15        self.title_prefix = title_prefix
     16        self.code = code
    1117
     18class FacultyFactory(grok.GlobalUtility):
     19    """A factory for faculty containers.
     20    """
     21    grok.implements(IFactory)
     22    grok.name(u'waeup.Faculty')
     23    title = u"Create a new faculty.",
     24    description = u"This factory instantiates new faculty instances."
     25
     26    def __call__(self):
     27        return Faculty()
     28
     29    def getInterfaces(self):
     30        return implementedBy(Faculty)
     31
     32       
    1233class DisplayForm(grok.DisplayForm):
    1334    grok.context(IFaculty)
     
    2445    formview_name = 'displayform' # The name of the formview we want
    2546                                  # to be rendered in this viewlet.
    26 
    27 grok.global_utility(Faculty, provides=IFaculty)
    2847
    2948
Note: See TracChangeset for help on using the changeset viewer.