[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/ComponentArchitecture - metaConfigure.py:1.2.12.1
Rakesh Naidu
rnaidu@zeomega.com
Mon, 21 Oct 2002 10:39:12 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/ComponentArchitecture
In directory cvs.zope.org:/tmp/cvs-serv2751/Zope3-Bangalore-TTW-Branch/lib/python/Zope/App/ComponentArchitecture
Modified Files:
Tag: Zope3-Bangalore-TTW-Branch
metaConfigure.py
Log Message:
added Interface actions for the parameters type,for_,provides
=== Zope3/lib/python/Zope/App/ComponentArchitecture/metaConfigure.py 1.2 => 1.2.12.1 ===
--- Zope3/lib/python/Zope/App/ComponentArchitecture/metaConfigure.py:1.2 Mon Jun 10 19:27:45 2002
+++ Zope3/lib/python/Zope/App/ComponentArchitecture/metaConfigure.py Mon Oct 21 10:38:42 2002
@@ -55,14 +55,30 @@
permission = CheckerPublic
checker = InterfaceChecker(provides, permission)
factory.append(lambda c: Proxy(c, checker))
-
- return [
- Action(
+ actions=[
+ Action(
discriminator = ('adapter', for_, provides),
callable = handler,
args = ('Adapters', 'provideAdapter', for_, provides, factory),
- )
- ]
+ ),
+ Action(
+ discriminator = None,
+ callable = handler,
+ args = ('Interfaces', 'provideInterface', provides.__module__+'.'+provides.__name__,provides)
+ )
+ ]
+ if for_ is not None:
+ actions.append
+ (
+ Action(
+ discriminator = None,
+ callable = handler,
+ args = ('Interfaces', 'provideInterface', for_.__module__+'.'+for_.__name__,for_)
+ )
+ )
+
+ return actions
+
def utility(_context, provides, component=None, factory=None, permission=None):
provides = _context.resolve(provides)
@@ -87,9 +103,15 @@
discriminator = ('utility', provides),
callable = handler,
args = ('Utilities', 'provideUtility', provides, component),
- )
+ ),
+ Action(
+ discriminator = None,
+ callable = handler,
+ args = ('Interfaces', 'provideInterface', provides.__module__+'.'+provides.__name__,provides)
+ )
]
+
def factory(_context, component, id=None):
if id is None:
id = component
@@ -160,7 +182,6 @@
def view(_context, factory, type, name, for_=None, layer='default',
permission=None, allowed_interface=None, allowed_attributes=None):
-
if ((allowed_attributes or allowed_interface)
and (not permission)):
raise ConfigurationError(
@@ -168,7 +189,6 @@
"allowed_attributes"
)
-
if for_ is not None: for_ = _context.resolve(for_)
type = _context.resolve(type)
@@ -186,13 +206,29 @@
factory[-1] = proxyView
- return [
+ actions=[
Action(
discriminator = ('view', for_, name, type, layer),
callable = handler,
args = ('Views','provideView',for_, name, type, factory, layer),
- )
- ]
+ ),
+ Action(
+ discriminator = None,
+ callable = handler,
+ args = ('Interfaces', 'provideInterface', type.__module__+'.'+type.__name__,type)
+ )
+ ]
+ if for_ is not None:
+ actions.append
+ (
+ Action(
+ discriminator = None,
+ callable = handler,
+ args = ('Interfaces', 'provideInterface', for_.__module__+'.'+for_.__name__,for_)
+ )
+ )
+
+ return actions
def defaultView(_context, type, name, for_=None, **__kw):
@@ -205,11 +241,27 @@
for_ = _context.resolve(for_)
type = _context.resolve(type)
- actions += [Action(
+ actions += [
+ Action(
discriminator = ('defaultViewName', for_, type, name),
callable = handler,
args = ('Views','setDefaultViewName', for_, type, name),
- )]
+ ),
+ Action(
+ discriminator = None,
+ callable = handler,
+ args = ('Interfaces', 'provideInterface', type.__module__+'.'+type.__name__,type)
+ )
+ ]
+ if for_ is not None:
+ actions.append
+ (
+ Action(
+ discriminator = None,
+ callable = handler,
+ args = ('Interfaces', 'provideInterface', for_.__module__+'.'+for_.__name__,for_)
+ )
+ )
return actions
@@ -272,11 +324,16 @@
raise TypeError("Commas are not allowed in layer names.")
layers = layers.strip().split()
- return [
+ actions = [
Action(
discriminator = ('skin', name, type),
callable = handler,
args = ('Skins','defineSkin',name, type, layers)
- )
- ]
-
+ ),
+ Action(
+ discriminator = None,
+ callable = handler,
+ args = ('Interfaces', 'provideInterface', type.__module__+'.'+type.__name__,type)
+ )
+ ]
+ return actions