[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ComponentArchitecture - ClassFactory.py:1.1

Jim Fulton jim@zope.com
Thu, 20 Jun 2002 16:00:20 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/ComponentArchitecture
In directory cvs.zope.org:/tmp/cvs-serv19918/lib/python/Zope/App/ComponentArchitecture

Added Files:
	ClassFactory.py 
Log Message:

Gary and Jim implemented most of:
http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/AddMenuProposalAndEndOfZmiNamespace

A lot of clean up is needed, including:

- Implementation additional add menus, for example for services.

- Ripping out old unused implementation.





=== Added File Zope3/lib/python/Zope/App/ComponentArchitecture/ClassFactory.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# 
##############################################################################
""" ZMI Addable Registration

$Id: ClassFactory.py,v 1.1 2002/06/20 20:00:19 jim Exp $
"""

from Zope.ComponentArchitecture.IFactory import IFactory

class ClassFactory:
    
    __implements__ = IFactory

    def __init__(self, _class):
        self._class = _class

    def __call__(self, *args, **kwargs):
        return self._class(*args, **kwargs)
    
    def getInterfaces(self):
        return getattr(self._class, '__implements__', None)