[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZMI - provideClass.py:1.1.2.3
Brian Lloyd
brian@digicool.com
Tue, 20 Nov 2001 15:02:09 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZMI
In directory cvs.zope.org:/tmp/cvs-serv30070
Modified Files:
Tag: Zope-3x-branch
provideClass.py
Log Message:
Added provideClass and ClassFactory implementation.
=== Zope3/lib/python/Zope/App/ZMI/provideClass.py 1.1.2.2 => 1.1.2.3 ===
""" ZMI Addable Registration """
-def provideClass(klass, permission):
+from Zope.ComponentArchitecture.IFactory import IFactory
+from Zope.ComponentArchitecture import provideFactory
+
+
+class ClassFactory:
+ __implements__ = IFactory
+
+ def __init__(self, _class, permission):
+ self.permission = permission
+ self._class = _class
+
+ def __call__(self):
+ # TODO: do something with permissions.
+ return self._class()
+
+
+def provideClass(qualified_name, _class, permission):
"""Provide simple class setup
- create a component
@@ -18,4 +34,5 @@
- set component permission
"""
- # TODO: Make me happen
+ factory = ClassFactory(_class, permission)
+ provideClass(qualified_name, factory)