[Zope3-checkins] CVS: Zope3/src/zope/app/component -
classfactory.py:1.6 contentdirective.py:1.11
Jim Fulton
jim at zope.com
Sun Sep 21 13:31:51 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/component
In directory cvs.zope.org:/tmp/cvs-serv13058/src/zope/app/component
Modified Files:
classfactory.py contentdirective.py
Log Message:
Changed the way factory permissions are handled. Now just create a
checker to be used later when the factory is proxied. Don't proxy the
factory right away.
=== Zope3/src/zope/app/component/classfactory.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/component/classfactory.py:1.5 Mon Aug 4 19:12:44 2003
+++ Zope3/src/zope/app/component/classfactory.py Sun Sep 21 13:31:21 2003
@@ -15,16 +15,21 @@
from zope.interface import implements, implementedBy
from zope.component.interfaces import IFactory
+from zope.security.checker import NamesChecker, CheckerPublic
class ClassFactory:
"Class that creates a factory component from a class"
implements(IFactory)
- def __init__(self, _class, title='', description=''):
+ def __init__(self, _class, title='', description='', permission=None):
self._class = _class
self.title = title
self.description = description
+ if permission is not None:
+ self.__Security_checker__ = NamesChecker(
+ __call__ = permission,
+ getInterfaces = CheckerPublic)
def __call__(self, *args, **kwargs):
return self._class(*args, **kwargs)
=== Zope3/src/zope/app/component/contentdirective.py 1.10 => 1.11 ===
--- Zope3/src/zope/app/component/contentdirective.py:1.10 Sun Aug 17 02:06:15 2003
+++ Zope3/src/zope/app/component/contentdirective.py Sun Sep 21 13:31:21 2003
@@ -200,16 +200,10 @@
"""
assertPermission(permission)
- factory = ClassFactory(_class, title, description)
if permission == PublicPermission:
permission = CheckerPublic
- if permission:
- # XXX should getInterfaces be public, as below?
- factory = ProxyFactory(factory,
- NamesChecker(('getInterfaces','title',
- 'description'),
- __call__=permission))
+ factory = ClassFactory(_class, title, description, permission)
getService(None, Factories).provideFactory(id, factory)
More information about the Zope3-Checkins
mailing list