[Checkins] SVN: zope.generic/trunk/src/zope/generic/ rename
IKeyInterface to IKeyface
Dominik Huber
dominik.huber at perse.ch
Tue Apr 18 06:22:55 EDT 2006
Log message for revision 67076:
rename IKeyInterface to IKeyface
rename relevant interface attributes to keyface and __keyface__
Changed:
U zope.generic/trunk/src/zope/generic/component/NEW_README.txt
U zope.generic/trunk/src/zope/generic/component/PUBLICATION.cfg
U zope.generic/trunk/src/zope/generic/component/README.txt
U zope.generic/trunk/src/zope/generic/component/adapter.py
U zope.generic/trunk/src/zope/generic/component/api.py
U zope.generic/trunk/src/zope/generic/component/base.py
U zope.generic/trunk/src/zope/generic/component/configure.zcml
U zope.generic/trunk/src/zope/generic/component/event.py
U zope.generic/trunk/src/zope/generic/component/helper.py
U zope.generic/trunk/src/zope/generic/component/interfaces.py
U zope.generic/trunk/src/zope/generic/component/metaconfigure.py
U zope.generic/trunk/src/zope/generic/component/metadirectives.py
U zope.generic/trunk/src/zope/generic/component/testing.py
U zope.generic/trunk/src/zope/generic/component/tests.py
U zope.generic/trunk/src/zope/generic/operation/README.txt
U zope.generic/trunk/src/zope/generic/operation/base.py
U zope.generic/trunk/src/zope/generic/operation/helper.py
U zope.generic/trunk/src/zope/generic/operation/interfaces.py
U zope.generic/trunk/src/zope/generic/operation/metaconfigure.py
U zope.generic/trunk/src/zope/generic/operation/metadirectives.py
U zope.generic/trunk/src/zope/generic/type/EXAMPLE.txt
U zope.generic/trunk/src/zope/generic/type/README.txt
U zope.generic/trunk/src/zope/generic/type/TODO.txt
U zope.generic/trunk/src/zope/generic/type/adapter.py
U zope.generic/trunk/src/zope/generic/type/base.py
U zope.generic/trunk/src/zope/generic/type/configure.zcml
U zope.generic/trunk/src/zope/generic/type/factory.py
U zope.generic/trunk/src/zope/generic/type/helper.py
U zope.generic/trunk/src/zope/generic/type/interfaces.py
U zope.generic/trunk/src/zope/generic/type/metaconfigure.py
U zope.generic/trunk/src/zope/generic/type/metadirectives.py
-=-
Modified: zope.generic/trunk/src/zope/generic/component/NEW_README.txt
===================================================================
--- zope.generic/trunk/src/zope/generic/component/NEW_README.txt 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/component/NEW_README.txt 2006-04-18 10:22:53 UTC (rev 67076)
@@ -46,7 +46,7 @@
>>> registerDirective('''
... <generic:configuration
- ... interface="example.ILogConfiguration"
+ ... keyface="example.ILogConfiguration"
... />
... ''')
@@ -62,7 +62,7 @@
>>> registerDirective('''
... <generic:configuration
- ... interface="example.ILoggerConfiguration"
+ ... keyface="example.ILoggerConfiguration"
... />
... ''')
@@ -70,14 +70,14 @@
>>> registerDirective('''
... <generic:informationProvider
- ... interface='example.ILogSupplierInformation'
+ ... keyface='example.ILogSupplierInformation'
... registry='zope.generic.component.IInformationProviderInformation'
... />
... ''')
>>> registerDirective('''
... <generic:informationProvider
- ... interface='example.ILogUserInformation'
+ ... keyface='example.ILogUserInformation'
... registry='zope.generic.component.IInformationProviderInformation'
... />
... ''')
@@ -92,35 +92,35 @@
>>> from zope.interface import implements
>>> from zope.component import adapts
- >>> from zope.generic.component import IKeyInterface
+ >>> from zope.generic.component import IKeyface
>>> class Logger(object):
... """Generic logger adapter."""
... implements(ILogger)
- ... adapts(IKeyInterface)
+ ... adapts(IKeyface)
... def __init__(self, context):
... self.context = context
... def log(self, message):
- ... id = IKeyInterface(self.context())
- ... info = queryInformationProvider(id.interface, ILogUserInformation)
+ ... id = IKeyface(self.context())
+ ... info = queryInformationProvider(id.keyface, ILogUserInformation)
>>> class Logger(object):
... """Generic logger adapter."""
... implements(ILogger)
- ... adapts(IKeyInterface)
+ ... adapts(IKeyface)
... def __init__(self, context):
... self.context = context
... def log(self, message):
- ... id = IKeyInterface(self.context())
- ... info = queryInformationProvider(id.interface, ILogUserInformation)
+ ... id = IKeyface(self.context())
+ ... info = queryInformationProvider(id.keyface, ILogUserInformation)
>>> class Logger(object):
... """Generic logger adapter."""
... implements(ILogger)
- ... adapts(IKeyInterface)
+ ... adapts(IKeyface)
... def __init__(self, context):
... self.context = context
... def log(self, message):
- ... id = IKeyInterface(self.context())
- ... info = queryInformationProvider(id.interface, ILogUserInformation)
+ ... id = IKeyface(self.context())
+ ... info = queryInformationProvider(id.keyface, ILogUserInformation)
Modified: zope.generic/trunk/src/zope/generic/component/PUBLICATION.cfg
===================================================================
--- zope.generic/trunk/src/zope/generic/component/PUBLICATION.cfg 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/component/PUBLICATION.cfg 2006-04-18 10:22:53 UTC (rev 67076)
@@ -5,6 +5,6 @@
Author-email: dominik.huber at perse.ch
License: ZPL 2.1
Description:
- This package offers a mechanism to declare a key interface (IKeyInterface).
+ This package offers a mechanism to declare a key interface (IKeyface).
The key interface can be used to lookup corresponding information providers
explicitly.
Modified: zope.generic/trunk/src/zope/generic/component/README.txt
===================================================================
--- zope.generic/trunk/src/zope/generic/component/README.txt 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/component/README.txt 2006-04-18 10:22:53 UTC (rev 67076)
@@ -9,7 +9,7 @@
lookup-algorithmus similar to the method resolution order by class inherintance.
Most of the time this behavior satisfies our requirements. Additionally this
-package offers a mechanism to declare a single key interface (IKeyInterface).
+package offers a mechanism to declare a single key interface (IKeyface).
This key interface can be used to lookup corresponding information providers
more explicitly.
@@ -55,7 +55,7 @@
>>> registerDirective('''
... <generic:informationProvider
- ... interface="example.IFooMarker"
+ ... keyface="example.IFooMarker"
... registry="example.ISpecialInformation"
... label='Foo Specials' hint='Bla bla foo.'
... />
@@ -87,7 +87,7 @@
>>> listing[0][0] == IFooMarker
True
- >>> info.key == IFooMarker
+ >>> info.keyface == IFooMarker
True
>>> ISpecialInformation.providedBy(info)
True
@@ -158,7 +158,7 @@
>>> registerDirective('''
... <generic:configuration
- ... interface="example.IMyConfiguration"
+ ... keyface="example.IMyConfiguration"
... label='My' hint='My bla.'
... />
... ''')
@@ -173,7 +173,7 @@
>>> from zope.generic.component.api import IConfigurationInformation
>>> my_config_ip = queryInformationProvider(IMyConfiguration, IConfigurationInformation)
- >>> my_config_ip.key == IMyConfiguration
+ >>> my_config_ip.keyface == IMyConfiguration
True
>>> IConfigurationInformation.providedBy(my_config_ip)
True
@@ -194,12 +194,12 @@
>>> registerDirective('''
... <generic:informationProvider
- ... interface="example.IFooMarker"
+ ... keyface="example.IFooMarker"
... registry="example.ISpecialInformation"
... label='Foo Specials' hint='Bla bla foo.'
... >
... <configuration
- ... interface="example.IMyConfiguration"
+ ... keyface="example.IMyConfiguration"
... data="example.my_information_config"
... />
... </generic:informationProvider>
@@ -226,7 +226,7 @@
>>> registerDirective('''
... <generic:configuration
- ... interface="example.IMyConfiguration"
+ ... keyface="example.IMyConfiguration"
... label='My' hint='My bla.'
... />
... ''')
Modified: zope.generic/trunk/src/zope/generic/component/adapter.py
===================================================================
--- zope.generic/trunk/src/zope/generic/component/adapter.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/component/adapter.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -31,43 +31,43 @@
from zope.generic.component import IAttributeConfigurable
from zope.generic.component import IConfigurationType
from zope.generic.component import IConfigurations
-from zope.generic.component import IKeyInterface
-from zope.generic.component import IAttributeKeyInterface
+from zope.generic.component import IKeyface
+from zope.generic.component import IAttributeKeyface
from zope.generic.component.event import Configuration
from zope.generic.component.event import ObjectConfiguredEvent
from zope.generic.component.helper import configuratonToDict
from zope.generic.component.helper import toDottedName
-from zope.generic.component.helper import toKeyInterface
+from zope.generic.component.helper import toKeyface
-class KeyInterface(object):
- """Adapts IAttributeKeyInterface to IKeyInterface.
+class Keyface(object):
+ """Adapts IAttributeKeyface to IKeyface.
- You can adapt IKeyInterface if you provide IAttributeKeyInterface:
+ You can adapt IKeyface if you provide IAttributeKeyface:
- >>> class AnyAttributeKeyInterface(KeyInterface):
- ... def __init__(self, key):
- ... self.__key_interface__ = key
+ >>> class AnyAttributeKeyface(Keyface):
+ ... def __init__(self, keyface):
+ ... self.__keyface__ = keyface
- >>> fake_key_interface = object()
- >>> any = AnyAttributeKeyInterface(fake_key_interface)
+ >>> fake_keyface = object()
+ >>> any = AnyAttributeKeyface(fake_keyface)
- >>> KeyInterface(any).key == fake_key_interface
+ >>> Keyface(any).keyface == fake_keyface
True
- >>> IKeyInterface.providedBy(KeyInterface(any))
+ >>> IKeyface.providedBy(Keyface(any))
True
"""
- implements(IKeyInterface)
- adapts(IAttributeKeyInterface)
+ implements(IKeyface)
+ adapts(IAttributeKeyface)
def __init__(self, context):
self.context = context
@property
- def key(self):
- return self.context.__key_interface__
+ def keyface(self):
+ return self.context.__keyface__
@@ -86,30 +86,30 @@
def __nonzero__(self):
return bool(getattr(self.context, '__configurations__', 0))
- def __conform__(self, interface):
+ def __conform__(self, keyface):
configurations = getattr(self.context, '__configurations__', None)
if configurations is None:
return None
else:
- return configurations.get(toDottedName(interface), None)
+ return configurations.get(toDottedName(keyface), None)
- def __getitem__(self, interface):
+ def __getitem__(self, keyface):
configurations = getattr(self.context, '__configurations__', None)
if configurations is None:
- raise KeyError(interface)
+ raise KeyError(keyface)
- return configurations[toDottedName(interface)]
+ return configurations[toDottedName(keyface)]
def keys(self):
configurations = getattr(self.context, '__configurations__', None)
if configurations is None:
return []
- return [toKeyInterface(iface) for iface in configurations.keys()]
+ return [toKeyface(iface) for iface in configurations.keys()]
- def update(self, interface, data):
- current_config = self[interface]
+ def update(self, keyface, data):
+ current_config = self[keyface]
updated_data = {}
errors = []
@@ -118,7 +118,7 @@
try:
for name, value in data.items():
# raise attribute error
- field = interface[name]
+ field = keyface[name]
if field.readonly:
raise ValueError(name, 'Data is readonly.')
else:
@@ -130,20 +130,20 @@
parent = self.__parent__
if updated_data and ILocation.providedBy(parent) and parent.__parent__ is not None:
notify(ObjectConfiguredEvent(parent,
- Configuration(interface, updated_data)))
+ Configuration(keyface, updated_data)))
except:
savepoint.rollback()
raise
- def __setitem__(self, interface, value):
+ def __setitem__(self, keyface, value):
# preconditions
- if not IConfigurationType.providedBy(interface):
+ if not IConfigurationType.providedBy(keyface):
raise KeyError('Interface key %s does not provide %s.' %
- (interface.__name__, IConfigurationType.__name__))
+ (keyface.__name__, IConfigurationType.__name__))
- if not interface.providedBy(value):
- raise ValueError('Value does not provide %s.' % interface.__name__)
+ if not keyface.providedBy(value):
+ raise ValueError('Value does not provide %s.' % keyface.__name__)
# essentials
try:
@@ -151,24 +151,24 @@
except AttributeError:
configurations = self.context.__configurations__ = OOBTree()
- data = configuratonToDict(interface, value, all=True)
- configurations[toDottedName(interface)] = value
+ data = configuratonToDict(keyface, value, all=True)
+ configurations[toDottedName(keyface)] = value
# notify setting
parent = self.__parent__
if ILocation.providedBy(parent) and parent.__parent__ is not None:
notify(ObjectConfiguredEvent(parent,
- Configuration(interface, data)))
+ Configuration(keyface, data)))
- def __delitem__(self, interface):
+ def __delitem__(self, keyface):
try:
configurations = self.context.__configurations__
except AttributeError:
- raise KeyError(interface)
+ raise KeyError(keyface)
- del configurations[toDottedName(interface)]
+ del configurations[toDottedName(keyface)]
# notify deletion
# notify setting
parent = self.__parent__
if ILocation.providedBy(parent) and parent.__parent__ is not None:
notify(ObjectConfiguredEvent(parent,
- Configuration(interface, {})))
+ Configuration(keyface, {})))
Modified: zope.generic/trunk/src/zope/generic/component/api.py
===================================================================
--- zope.generic/trunk/src/zope/generic/component/api.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/component/api.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -26,32 +26,32 @@
from zope.generic.component import *
from zope.generic.component.base import ConfigurationData
from zope.generic.component.base import InformationProvider
-from zope.generic.component.base import KeyInterface
-from zope.generic.component.base import KeyInterfaceDescription
+from zope.generic.component.base import Keyface
+from zope.generic.component.base import KeyfaceDescription
from zope.generic.component.helper import configuratonToDict
from zope.generic.component.helper import toDottedName
-from zope.generic.component.helper import toKeyInterface
+from zope.generic.component.helper import toKeyface
def getKey(object):
- """Evaluate the interface key from an object."""
+ """Evaluate the interface keyface from an object."""
if IInterface.providedBy(object):
- interface = object
+ keyface = object
- elif IKeyInterface.providedBy(object):
- interface = object.interface
+ elif IKeyface.providedBy(object):
+ keyface = object.keyface
else:
- interface = IKeyInterface(object).interface
+ keyface = IKeyface(object).keyface
- return interface
+ return keyface
def queryKey(object, default=None):
- """Evaluate the interface key from an object."""
+ """Evaluate the keyface keyface from an object."""
try:
return getKey(object)
@@ -82,49 +82,49 @@
"""Evaluate all information providers of a certain information aspect."""
for name, information in getUtilitiesFor(provider):
- yield (toKeyInterface(name), information)
+ yield (toKeyface(name), information)
-def getInformation(context, key):
- """Evaluate an information by a key (string or key interface)."""
- if IConfigurationType.providedBy(key):
- return key(IConfigurations(context))
+def getInformation(context, keyface):
+ """Evaluate an information by a keyface (string or key keyface)."""
+ if IConfigurationType.providedBy(keyface):
+ return keyface(IConfigurations(context))
else:
- return IAnnotations(context)[key]
+ return IAnnotations(context)[keyface]
-def queryInformation(context, key, default=None):
- """Evaluate an information by a key (string or key interface)."""
+def queryInformation(context, keyface, default=None):
+ """Evaluate an information by a keyface (string or key interface)."""
try:
- return getInformation(context, key)
+ return getInformation(context, keyface)
except:
return default
-def provideInformation(context, key, information):
- """Set an information to a context using a key (string or key interface)."""
+def provideInformation(context, keyface, information):
+ """Set an information to a context using a keyface (string or key interface)."""
- if IConfigurationType.providedBy(key):
+ if IConfigurationType.providedBy(keyface):
if type(information) is dict:
- information = ConfigurationData(key, information)
+ information = ConfigurationData(keyface, information)
- IConfigurations(context)[key] = information
+ IConfigurations(context)[keyface] = information
else:
- IAnnotations(context)[key] = information
+ IAnnotations(context)[keyface] = information
-def deleteInformation(context, key):
- """Delete an information of a context using a key (string or key interface)."""
+def deleteInformation(context, keyface):
+ """Delete an information of a context using a keyface (string or key interface)."""
- if IConfigurationType.providedBy(key):
- del IConfigurations(context)[key]
+ if IConfigurationType.providedBy(keyface):
+ del IConfigurations(context)[keyface]
else:
- del IAnnotations(context)[key]
+ del IAnnotations(context)[keyface]
Modified: zope.generic/trunk/src/zope/generic/component/base.py
===================================================================
--- zope.generic/trunk/src/zope/generic/component/base.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/component/base.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -33,59 +33,59 @@
from zope.generic.component import IConfigurationData
from zope.generic.component import IConfigurations
from zope.generic.component import IInformationProvider
-from zope.generic.component import IKeyInterface
-from zope.generic.component import IAttributeKeyInterface
-from zope.generic.component import IKeyInterfaceDescription
+from zope.generic.component import IKeyface
+from zope.generic.component import IAttributeKeyface
+from zope.generic.component import IKeyfaceDescription
from zope.generic.component import adapter
from zope.generic.component.helper import toDottedName
-class KeyInterface(object):
+class Keyface(object):
"""Key interface mixin for key interface attribute implementations.
- You can mixin this class if you like to provide IKeyInterface for
- IAttributeKeyInterface implementations:
+ You can mixin this class if you like to provide IKeyface for
+ IAttributeKeyface implementations:
- >>> class AnyAttributeKeyInterface(KeyInterface):
- ... def __init__(self, key):
- ... self.__key_interface__ = key
+ >>> class AnyAttributeKeyface(Keyface):
+ ... def __init__(self, keyface):
+ ... self.__keyface__ = keyface
- >>> fake_key_interface = object()
- >>> any = AnyAttributeKeyInterface(fake_key_interface)
- >>> any.__key_interface__ == fake_key_interface
+ >>> fake_keyface = object()
+ >>> any = AnyAttributeKeyface(fake_keyface)
+ >>> any.__keyface__ == fake_keyface
True
You get only the following method decorator for free :):
- >>> any.key == fake_key_interface
+ >>> any.keyface == fake_keyface
True
"""
- implements(IKeyInterface)
+ implements(IKeyface)
@property
- def key(self):
- return self.__key_interface__
+ def keyface(self):
+ return self.__keyface__
-class KeyInterfaceDescription(KeyInterface):
+class KeyfaceDescription(Keyface):
"""Key interface description mixin."""
- implements(IKeyInterfaceDescription)
+ implements(IKeyfaceDescription)
- def __init__(self, key, label=None, hint=None):
- self.__key_interface__ = key
+ def __init__(self, keyface, label=None, hint=None):
+ self.__keyface__ = keyface
if label is None:
- self.label = _(key.__name__)
+ self.label = _(keyface.__name__)
else:
self.label = label
if hint is None:
- self.hint = _(key.__doc__)
+ self.hint = _(keyface.__doc__)
else:
self.hint = hint
@@ -152,20 +152,20 @@
...
RuntimeError: ('Data value is not a schema field', 'method')
- The implementation provide an adapter to IKeyInterface by its __conform__
+ The implementation provide an adapter to IKeyface by its __conform__
method:
- >>> adapted = IKeyInterface(config_data)
- >>> IKeyInterface.providedBy(adapted)
+ >>> adapted = IKeyface(config_data)
+ >>> IKeyface.providedBy(adapted)
True
- >>> adapted.key is IBarConfiguration
+ >>> adapted.keyface is IBarConfiguration
True
"""
- implements(IAttributeKeyInterface, IConfigurationData)
+ implements(IAttributeKeyface, IConfigurationData)
def __init__(self, schema, data):
# preconditions
@@ -181,19 +181,19 @@
# essentials
self.__dict__['_ConfigurationData__data'] = PersistentDict(data)
- self.__dict__['__key_interface__'] = schema
+ self.__dict__['__keyface__'] = schema
directlyProvides(self, schema)
- def __conform__(self, interface):
- if interface is IKeyInterface:
- return adapter.KeyInterface(self)
+ def __conform__(self, keyface):
+ if keyface is IKeyface:
+ return adapter.Keyface(self)
def __getattr__(self, name):
- # assert IAttributeKeyInterface
- if name == '__key_interface__':
- return self.__dict__['__key_interface__']
+ # assert IAttributeKeyface
+ if name == '__keyface__':
+ return self.__dict__['__keyface__']
- schema = self.__dict__['__key_interface__']
+ schema = self.__dict__['__keyface__']
data = self.__dict__['_ConfigurationData__data']
try:
field = schema[name]
@@ -217,7 +217,7 @@
raise AttributeError(name)
def __setattr__(self, name, value):
- schema = self.__dict__['__key_interface__']
+ schema = self.__dict__['__keyface__']
data = self.__dict__['_ConfigurationData__data']
if name != '__provides__':
@@ -234,7 +234,7 @@
-class InformationProvider(KeyInterfaceDescription, dict):
+class InformationProvider(KeyfaceDescription, dict):
"""Generic information provider.
Information do relate a dedicated type of information marked as an interface
@@ -257,7 +257,7 @@
The information is related to the interface declared by the interface
attribute:
- >>> info.key == IFooMarker
+ >>> info.keyface == IFooMarker
True
>>> info.label
u'IFooMarker'
@@ -278,6 +278,6 @@
implements(IInformationProvider, IAttributeConfigurable, IAttributeAnnotatable)
- def __init__(self, key, provides, label=None, hint=None):
- super(InformationProvider, self).__init__(key, label, hint)
+ def __init__(self, keyface, provides, label=None, hint=None):
+ super(InformationProvider, self).__init__(keyface, label, hint)
alsoProvides(self, provides)
\ No newline at end of file
Modified: zope.generic/trunk/src/zope/generic/component/configure.zcml
===================================================================
--- zope.generic/trunk/src/zope/generic/component/configure.zcml 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/component/configure.zcml 2006-04-18 10:22:53 UTC (rev 67076)
@@ -4,13 +4,13 @@
i18n_domain="zope">
<generic:informationProvider
- interface=".IConfigurationInformation"
+ keyface=".IConfigurationInformation"
label="Configuration Information"
registry="zope.generic.component.IInformationProviderInformation"
/>
<generic:informationProvider
- interface=".IInformationProviderInformation"
+ keyface=".IInformationProviderInformation"
label="Information Provider Information"
registry=".IInformationProviderInformation"
/>
Modified: zope.generic/trunk/src/zope/generic/component/event.py
===================================================================
--- zope.generic/trunk/src/zope/generic/component/event.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/component/event.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -44,7 +44,7 @@
>>> IConfigurationModificationDescription.providedBy(description)
True
- >>> description.interface == IMyConfiguration
+ >>> description.keyface == IMyConfiguration
True
>>> 'my' in description.data
@@ -56,7 +56,7 @@
dict, which implies that the configuration was deleted:
>>> description = Configuration(IMyConfiguration)
- >>> description.interface == IMyConfiguration
+ >>> description.keyface == IMyConfiguration
True
>>> description.data
@@ -66,8 +66,8 @@
implements(IConfigurationModificationDescription)
- def __init__(self, interface, data=None) :
- self.interface = interface
+ def __init__(self, keyface, data=None) :
+ self.keyface = keyface
if data is not None:
self.data = data
@@ -132,12 +132,12 @@
self.descriptions = descriptions
def items(self):
- return [(d.interface, d.data) for d in self.descriptions
+ return [(d.keyface, d.data) for d in self.descriptions
if IConfigurationModificationDescription.providedBy(d)]
- def get(self, interface, default=None):
+ def get(self, keyface, default=None):
result = [d.data for d in self.descriptions
- if IConfigurationModificationDescription.providedBy(d) and d.interface is interface]
+ if IConfigurationModificationDescription.providedBy(d) and d.keyface is keyface]
if result:
return result[0]
Modified: zope.generic/trunk/src/zope/generic/component/helper.py
===================================================================
--- zope.generic/trunk/src/zope/generic/component/helper.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/component/helper.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -31,7 +31,7 @@
# cache
__name_to_component = {}
-def toKeyInterface(name):
+def toKeyface(name):
try:
return __name_to_component[name]
except KeyError:
Modified: zope.generic/trunk/src/zope/generic/component/interfaces.py
===================================================================
--- zope.generic/trunk/src/zope/generic/component/interfaces.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/component/interfaces.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -40,17 +40,17 @@
#
###############################################################################
-class IKeyInterfaceProvider(Interface):
+class IKeyfaceProvider(Interface):
"""Assert that a key interface can be looked up.
- The key interface must be provided by adaption to IKeyInterface."""
+ The key interface must be provided by adaption to IKeyface."""
-class IAttributeKeyInterface(IKeyInterfaceProvider):
- """Provide the key interface within the __key_interface__ attribute."""
+class IAttributeKeyface(IKeyfaceProvider):
+ """Provide the key interface within the __keyface__ attribute."""
- __key_interface__ = Object(
+ __keyface__ = Object(
title=_('Key interface'),
description=_('Key interface that allows to lookup ' +
'key-interface-specific informations such as ' +
@@ -61,13 +61,13 @@
-class IKeyInterface(IKeyInterfaceProvider):
+class IKeyface(IKeyfaceProvider):
"""Declare a key interface as component-specific key.
You can use this key to lookup component-specific informations.
"""
- key = Object(
+ keyface = Object(
title=_('Key interface'),
description=_('Key interface of the adapted context.'),
required=True,
@@ -76,7 +76,7 @@
-class IKeyInterfaceDescription(IKeyInterface):
+class IKeyfaceDescription(IKeyface):
"""User description about the associated key interface."""
label = TextLine(title=_('Label'),
@@ -106,7 +106,7 @@
-class IConfigurationData(IKeyInterfaceProvider):
+class IConfigurationData(IKeyfaceProvider):
"""Marker for configuration data implementations."""
@@ -114,7 +114,7 @@
class IReadConfigurations(Interface):
"""Read configuration data or looku for a certain configuration shema."""
- def __conform__(key_interface):
+ def __conform__(keyface):
"""Invoke configuration data that are stored under the key interface.
Regularly the interface-key should provide configuration type.
@@ -124,7 +124,7 @@
def __nonzero__():
"""Test whether there are any configurations at all."""
- def __getitem__(key_interface):
+ def __getitem__(keyface):
"""Return the configuration data stored under key interface.
Raises a KeyError if the key interface is not found.
@@ -138,7 +138,7 @@
class IUpdateConfigurations(Interface):
"""Update configuration data."""
- def update(key_interface, data):
+ def update(keyface, data):
"""Update the configuration data partially if nessecary.
data - dict providing keys and values corresponding to key interface.
@@ -162,7 +162,7 @@
class IWriteConfigurations(Interface):
"""Set or delete a configuration data."""
- def __setitem__(key_interface, configuration_data):
+ def __setitem__(keyface, configuration_data):
"""Store a certain configuration data under the interface-key.
The interface key should provide IConfigurationType.
@@ -177,7 +177,7 @@
context (parent of the configurations) is providing ILocation.
"""
- def __delitem__(key_interface):
+ def __delitem__(keyface):
"""Removes the configuration data stored under interface-key.
Raises a KeyError if the key interface is not found.
@@ -207,7 +207,7 @@
-class IInformationProvider(IKeyInterfaceDescription):
+class IInformationProvider(IKeyfaceDescription):
"""Provide information about a dedicated key interfaces.
A configuration related to the key interface can be stored within the
Modified: zope.generic/trunk/src/zope/generic/component/metaconfigure.py
===================================================================
--- zope.generic/trunk/src/zope/generic/component/metaconfigure.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/component/metaconfigure.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -35,7 +35,7 @@
from zope.generic.component.helper import toDottedName
-def provideInformationProvider(interface, registry=IInformationProviderInformation, label=None, hint=None, factory=None):
+def provideInformationProvider(keyface, registry=IInformationProviderInformation, label=None, hint=None, factory=None):
"""Provide new information for the given registry-interface.
Register an information as utiliy under registry-interface using
@@ -54,7 +54,7 @@
>>> from zope.generic.component.helper import queryInformationProvider
>>> info = queryInformationProvider(IFooMarker, ISpecialInformation)
- >>> info.interface == IFooMarker
+ >>> info.keyface == IFooMarker
True
>>> ISpecialInformation.providedBy(info)
True
@@ -68,19 +68,19 @@
if factory is None:
factory = InformationProvider
- component = factory(interface, registry, label, hint)
+ component = factory(keyface, registry, label, hint)
if not registry.providedBy(component):
raise ValueError('Factory must implement %s.' % registry.__name__)
- provideUtility(component, provides=registry, name=toDottedName(interface))
+ provideUtility(component, provides=registry, name=toDottedName(keyface))
-def provideConfiguration(interface, registry, configuration, data):
+def provideConfiguration(keyface, registry, configuration, data):
"""Provide configuration for a certain type marker."""
- info = queryInformationProvider(interface, registry)
+ info = queryInformationProvider(keyface, registry)
configurations = IConfigurations(info)
configurations[configuration] = data
@@ -92,25 +92,25 @@
_information_type = None
- def __init__(self, _context, interface, registry, label=None, hint=None):
- self._interface = interface
+ def __init__(self, _context, keyface, registry, label=None, hint=None):
+ self._keyface = keyface
self._context = _context
self._registry = registry
# assert type as soon as possible
if self._information_type is not None:
- alsoProvides(interface, self._information_type)
+ alsoProvides(keyface, self._information_type)
_context.action(
- discriminator = ('provideInformationProvider', self._interface, self._registry),
+ discriminator = ('provideInformationProvider', self._keyface, self._registry),
callable = provideInformationProvider,
- args = (self._interface, self._registry, label, hint),
+ args = (self._keyface, self._registry, label, hint),
)
_context.action(
discriminator = None,
callable = provideInterface,
- args = (None, self._interface),
+ args = (None, self._keyface),
)
_context.action(
@@ -123,38 +123,38 @@
"Handle empty/simple declaration."
return ()
- def configuration(self, _context, interface, data):
+ def configuration(self, _context, keyface, data):
# preconditions
- if not interface.providedBy(data):
- raise ConfigurationError('Data attribute must provide %s.' % interface.__name__)
+ if not keyface.providedBy(data):
+ raise ConfigurationError('Data attribute must provide %s.' % keyface.__name__)
_context.action(
discriminator = (
- 'InformationConfiguration', self._interface, self._registry, interface),
+ 'InformationConfiguration', self._keyface, self._registry, keyface),
callable = provideConfiguration,
- args = (self._interface, self._registry, interface, data),
+ args = (self._keyface, self._registry, keyface, data),
)
-def configurationDirective(_context, interface, label=None, hint=None):
+def configurationDirective(_context, keyface, label=None, hint=None):
"""Provide new configuration information."""
registry = IConfigurationInformation
iface_type = IConfigurationType
# assert type as soon as possible
- if not iface_type.providedBy(interface):
- alsoProvides(interface, iface_type)
+ if not iface_type.providedBy(keyface):
+ alsoProvides(keyface, iface_type)
_context.action(
- discriminator = ('provideInformationProvider', interface, registry),
+ discriminator = ('provideInformationProvider', keyface, registry),
callable = provideInformationProvider,
- args = (interface, registry, label, hint),
+ args = (keyface, registry, label, hint),
)
_context.action(
discriminator = None,
callable = provideInterface,
- args = (None, interface, iface_type),
+ args = (None, keyface, iface_type),
)
Modified: zope.generic/trunk/src/zope/generic/component/metadirectives.py
===================================================================
--- zope.generic/trunk/src/zope/generic/component/metadirectives.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/component/metadirectives.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -31,7 +31,7 @@
class IBaseInformationProviderDirective(Interface):
"""Base information attributes."""
- interface = GlobalInterface(
+ keyface = GlobalInterface(
title=_('Interface'),
description=_('Interface that represents an information.'),
required=True
@@ -77,7 +77,7 @@
class IConfigurationSubdirective(Interface):
"""Declare a certain configuration of a type."""
- interface = GlobalInterface(
+ keyface = GlobalInterface(
title=_('Interface'),
description=_('Interface referencing a configuraiton.'),
required=True
Modified: zope.generic/trunk/src/zope/generic/component/testing.py
===================================================================
--- zope.generic/trunk/src/zope/generic/component/testing.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/component/testing.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -57,8 +57,8 @@
fo = TextLine(title=u'Fo', required=False, readonly=True, default=u'fo default')
-class TestKeyInterfaceAttriute(object):
- __key__interface__ = IFooConfiguration
+class TestKeyfaceAttriute(object):
+ __keyface__ = IFooConfiguration
################################################################################
Modified: zope.generic/trunk/src/zope/generic/component/tests.py
===================================================================
--- zope.generic/trunk/src/zope/generic/component/tests.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/component/tests.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -62,27 +62,27 @@
self.assertEqual(getattr(test_obj, 'fo'), fo_field.default)
-class KeyInterfaceAdapterTest(InterfaceBaseTest):
+class KeyfaceAdapterTest(InterfaceBaseTest):
@property
def _test_interface(self):
- from zope.generic.component import IKeyInterface
- return IKeyInterface
+ from zope.generic.component import IKeyface
+ return IKeyface
@property
def _test_class(self):
- from zope.generic.component.adapter import KeyInterface
- return KeyInterface
+ from zope.generic.component.adapter import Keyface
+ return Keyface
@property
def _test_pos(self):
- return (testing.TestKeyInterfaceAttriute(),)
+ return (testing.TestKeyfaceAttriute(),)
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(ConfigurationDataTest),
- #TODO: Why does it fail? unittest.makeSuite(KeyInterfaceAdapterTest),
+ #TODO: Why does it fail? unittest.makeSuite(KeyfaceAdapterTest),
doctest.DocTestSuite('zope.generic.component.helper'),
doctest.DocTestSuite('zope.generic.component.base'),
doctest.DocTestSuite('zope.generic.component.event'),
Modified: zope.generic/trunk/src/zope/generic/operation/README.txt
===================================================================
--- zope.generic/trunk/src/zope/generic/operation/README.txt 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/operation/README.txt 2006-04-18 10:22:53 UTC (rev 67076)
@@ -44,25 +44,25 @@
>>> registerDirective('''
... <generic:configuration
- ... interface="example.IPAUConfig"
+ ... keyface="example.IPAUConfig"
... />
... ''')
>>> registerDirective('''
... <generic:configuration
- ... interface="example.IAnyInputConfig"
+ ... keyface="example.IAnyInputConfig"
... />
... ''')
>>> registerDirective('''
... <generic:configuration
- ... interface="example.IAConfig"
+ ... keyface="example.IAConfig"
... />
... ''')
>>> registerDirective('''
... <generic:configuration
- ... interface="example.IBConfig"
+ ... keyface="example.IBConfig"
... />
... ''')
@@ -80,14 +80,14 @@
>>> registerDirective('''
... <generic:operation
- ... interface="example.IMakeSiteOperation"
+ ... keyface="example.IMakeSiteOperation"
... operations="example.makeSiteOperation"
... />
... ''')
>>> registerDirective('''
... <generic:operation
- ... interface="example.ISetupPAUOperation"
+ ... keyface="example.ISetupPAUOperation"
... operations="example.setupPAUOperation"
... input="example.IPAUConfig"
... />
@@ -95,7 +95,7 @@
>>> registerDirective('''
... <generic:operation
- ... interface="example.IConfigureAnythingOperation"
+ ... keyface="example.IConfigureAnythingOperation"
... operations="example.configureAnythingOperation"
... input="example.IPAUConfig"
... />
@@ -120,7 +120,7 @@
>>> registerDirective('''
... <generic:configuration
- ... interface="example.IComplexConfig"
+ ... keyface="example.IComplexConfig"
... />
... ''')
@@ -136,7 +136,7 @@
>>> registerDirective('''
... <generic:operation
- ... interface="example.IMakeSiteSetupPAUConfigureAnythingOperation"
+ ... keyface="example.IMakeSiteSetupPAUConfigureAnythingOperation"
... operations="example.IMakeSiteOperation example.setupPAUOperation
... example.configureAnythingOperation example.privateOperation"
... input="example.IComplexConfig"
Modified: zope.generic/trunk/src/zope/generic/operation/base.py
===================================================================
--- zope.generic/trunk/src/zope/generic/operation/base.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/operation/base.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -21,29 +21,29 @@
from zope.interface import implements
from zope.schema.fieldproperty import FieldProperty
-from zope.generic.component import IAttributeKeyInterface
-from zope.generic.component.api import KeyInterface
+from zope.generic.component import IAttributeKeyface
+from zope.generic.component.api import Keyface
from zope.generic.operation import IOperation
from zope.generic.operation import IPrivateOperation
-class Operation(KeyInterface):
+class Operation(Keyface):
"""Generic operation wrapper."""
implements(IOperation)
- interface = FieldProperty(IAttributeKeyInterface['__key_interface__'])
+ keyface = FieldProperty(IAttributeKeyface['__keyface__'])
- def __init__(self, callable=None, interface=None):
+ def __init__(self, callable=None, keyface=None):
self.__callable = callable
# otherwise use IPrivatConfigurationHandler
- if interface is not None:
- self.__key_interface__ = interface
+ if keyface is not None:
+ self.__keyface__ = keyface
else:
- self.__key_interface__ = IPrivateOperation
+ self.__keyface__ = IPrivateOperation
def __call__(self, context, *pos, **kws):
self._proceed(context)
@@ -58,8 +58,8 @@
class OperationChain(Operation):
"""Generic operation chain wrapper."""
- def __init__(self, operations, interface=None):
- super(OperationChain, self).__init__(None, interface)
+ def __init__(self, operations, keyface=None):
+ super(OperationChain, self).__init__(None, keyface)
self.__operations = operations
def _proceed(self, context, *pos, **kws):
Modified: zope.generic/trunk/src/zope/generic/operation/helper.py
===================================================================
--- zope.generic/trunk/src/zope/generic/operation/helper.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/operation/helper.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -59,33 +59,33 @@
-def queryOperation(interface, default=None):
+def queryOperation(keyface, default=None):
"""Return the operation of operation marker."""
try:
- return getOperationConfiguration(interface).operation
+ return getOperationConfiguration(keyface).operation
except:
return default
-def queryOperationInput(interface, default=None):
- """Return the input paramters of an operation as tuple of configuration interfaces."""
+def queryOperationInput(keyface, default=None):
+ """Return the input paramters of an operation as tuple of configuration keyfaces."""
try:
- return getOperationConfiguration(interface).input
+ return getOperationConfiguration(keyface).input
except:
return default
-def queryOperationOutput(interface, default=None):
- """Return the ouput paramters of an operation as tuple of configuration interfaces."""
+def queryOperationOutput(keyface, default=None):
+ """Return the ouput paramters of an operation as tuple of configuration keyfaces."""
try:
- return getOperationConfiguration(interface).output
+ return getOperationConfiguration(keyface).output
except:
return default
Modified: zope.generic/trunk/src/zope/generic/operation/interfaces.py
===================================================================
--- zope.generic/trunk/src/zope/generic/operation/interfaces.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/operation/interfaces.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -26,7 +26,7 @@
from zope.schema import Object
from zope.schema import Tuple
-from zope.generic.component import IKeyInterface
+from zope.generic.component import IKeyface
from zope.generic.component import IConfigurationType
from zope.generic.component import IInformationProvider
from zope.generic.component import IInformationProviderType
@@ -38,7 +38,7 @@
class IContextProxy(Interface):
"""Proxy the context of a component."""
- def __conform__(interface):
+ def __conform__(keyface):
"""Might cache adapters."""
def __getattr__(name):
@@ -49,7 +49,7 @@
-class IOperation(IKeyInterface):
+class IOperation(IKeyface):
"""Proceed operation"""
def __call__(context, *pos, **kws):
Modified: zope.generic/trunk/src/zope/generic/operation/metaconfigure.py
===================================================================
--- zope.generic/trunk/src/zope/generic/operation/metaconfigure.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/operation/metaconfigure.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -39,7 +39,7 @@
from zope.generic.operation.base import OperationChain
-def _assertOperation(handler, interface=None):
+def _assertOperation(handler, keyface=None):
"""Assert that we get an operation."""
if IOperation.providedBy(handler):
@@ -60,30 +60,30 @@
return config.operation
# asume callabe (context)
- return Operation(handler, interface)
+ return Operation(handler, keyface)
-def provideOperationConfiguration(interface, operations=(), input=(), output=()):
+def provideOperationConfiguration(keyface, operations=(), input=(), output=()):
"""Provide the handler to an configuration information."""
registry = IOperationInformation
- info = queryInformationProvider(interface, IOperationInformation)
+ info = queryInformationProvider(keyface, IOperationInformation)
# this should never happen...
if info is None:
ConfigurationError('No operation information for %s'
- % interface.__name__)
+ % keyface.__name__)
if len(operations) == 0:
# hidding overwrite -> pass handler
- operation = _assertOperation(None, interface)
+ operation = _assertOperation(None, keyface)
elif len(operations) == 1:
- operation = _assertOperation(operations[0], interface)
+ operation = _assertOperation(operations[0], keyface)
else:
- operation = OperationChain([_assertOperation(handler) for handler in operations], interface)
+ operation = OperationChain([_assertOperation(handler) for handler in operations], keyface)
configurations = IConfigurations(info)
# create and set configuration data
@@ -92,23 +92,23 @@
-def operationDirective(_context, interface, operations=(), input=(), output=(), label=None, hint=None):
+def operationDirective(_context, keyface, operations=(), input=(), output=(), label=None, hint=None):
"""Register a public operation."""
# assert type as soon as possible
- if not IOperationType.providedBy(interface):
- alsoProvides(interface, IOperationType)
+ if not IOperationType.providedBy(keyface):
+ alsoProvides(keyface, IOperationType)
registry = IOperationInformation
_context.action(
- discriminator = ('provideInformationProvider', interface, registry),
+ discriminator = ('provideInformationProvider', keyface, registry),
callable = provideInformationProvider,
- args = (interface, registry, label, hint),
+ args = (keyface, registry, label, hint),
)
_context.action(
- discriminator = ('provideOperationConfiguration', interface),
+ discriminator = ('provideOperationConfiguration', keyface),
callable = provideOperationConfiguration,
- args = (interface, operations, input, output),
+ args = (keyface, operations, input, output),
)
Modified: zope.generic/trunk/src/zope/generic/operation/metadirectives.py
===================================================================
--- zope.generic/trunk/src/zope/generic/operation/metadirectives.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/operation/metadirectives.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -36,7 +36,7 @@
operations = Tokens(
title=_('Operation or IOperationType'),
- description=_('Global operation or callable(context) or IOperationType interface.'),
+ description=_('Global operation or callable(context) or IOperationType keyface.'),
required=False,
value_type=GlobalObject()
)
Modified: zope.generic/trunk/src/zope/generic/type/EXAMPLE.txt
===================================================================
--- zope.generic/trunk/src/zope/generic/type/EXAMPLE.txt 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/type/EXAMPLE.txt 2006-04-18 10:22:53 UTC (rev 67076)
@@ -42,19 +42,19 @@
>>> registerDirective('''
... <generic:configuration
- ... interface="example.ITextConfig"
+ ... keyface="example.ITextConfig"
... />
... ''')
>>> registerDirective('''
... <generic:configuration
- ... interface="example.INoteConfig"
+ ... keyface="example.INoteConfig"
... />
... ''')
>>> registerDirective('''
... <generic:configuration
- ... interface="example.IArticleInitializationConfiguration"
+ ... keyface="example.IArticleInitializationConfiguration"
... />
... ''')
@@ -106,14 +106,14 @@
>>> registerDirective('''
... <generic:type
- ... interface="example.IText"
+ ... keyface="example.IText"
... class='zope.generic.type.api.Object'
... >
... <initializer
- ... interface='example.ITextConfig'
+ ... keyface='example.ITextConfig'
... />
... <configuration
- ... interface='example.ITextConfig'
+ ... keyface='example.ITextConfig'
... data='example.textDefaults'
... />
... </generic:type>
@@ -121,14 +121,14 @@
>>> registerDirective('''
... <generic:type
- ... interface="example.INote"
+ ... keyface="example.INote"
... class='zope.generic.type.api.Object'
... >
... <initializer
- ... interface='example.INoteConfig'
+ ... keyface='example.INoteConfig'
... />
... <configuration
- ... interface='example.INoteConfig'
+ ... keyface='example.INoteConfig'
... data='example.noteDefaults'
... />
... </generic:type>
@@ -136,19 +136,19 @@
>>> registerDirective('''
... <generic:type
- ... interface="example.IArticle"
+ ... keyface="example.IArticle"
... class='zope.generic.type.api.Object'
... >
... <initializer
- ... interface='example.IArticleInitializationConfiguration'
+ ... keyface='example.IArticleInitializationConfiguration'
... handler="example.articleInitializer"
... />
... <configuration
- ... interface='example.ITextConfig'
+ ... keyface='example.ITextConfig'
... data='example.articleTextDefaults'
... />
... <configuration
- ... interface='example.INoteConfig'
+ ... keyface='example.INoteConfig'
... data='example.articleNoteDefaults'
... />
... </generic:type>
Modified: zope.generic/trunk/src/zope/generic/type/README.txt
===================================================================
--- zope.generic/trunk/src/zope/generic/type/README.txt 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/type/README.txt 2006-04-18 10:22:53 UTC (rev 67076)
@@ -47,7 +47,7 @@
>>> registerDirective('''
... <generic:type
- ... interface="example.IFooMarker"
+ ... keyface="example.IFooMarker"
... label='Foo Type' hint='Bla bla bla.'
... class='zope.generic.type.api.Object'
... />
@@ -64,7 +64,7 @@
>>> foo = api.createObject(IFooMarker)
>>> typed = api.ITyped(foo)
- >>> typed.interface == IFooMarker
+ >>> typed.keyface == IFooMarker
True
In our example we use a generic directly typed implementation. In those cases
@@ -81,7 +81,7 @@
>>> info = queryUtility(api.ITypeInformation, toDottedName(IFooMarker))
- >>> info.key == IFooMarker
+ >>> info.keyface == IFooMarker
True
>>> info.label
u'Foo Type'
@@ -128,14 +128,14 @@
>>> registerDirective('''
... <generic:configuration
- ... interface="example.IAnyConfiguration"
+ ... keyface="example.IAnyConfiguration"
... label='Any' hint='Any bla.'
... />
... ''')
>>> registerDirective('''
... <generic:configuration
- ... interface="example.IOtherConfiguration"
+ ... keyface="example.IOtherConfiguration"
... />
... ''')
@@ -153,16 +153,16 @@
>>> registerDirective('''
... <generic:type
- ... interface="example.IBarMarker"
+ ... keyface="example.IBarMarker"
... label='Bar Type' hint='Bla bla bla.'
... class='zope.generic.type.api.Object'
... >
... <initializer
- ... interface='example.IOtherConfiguration'
+ ... keyface='example.IOtherConfiguration'
... handler='example.barInitializer'
... />
... <configuration
- ... interface='example.IAnyConfiguration'
+ ... keyface='example.IAnyConfiguration'
... data='example.typedata'
... />
... </generic:type>
Modified: zope.generic/trunk/src/zope/generic/type/TODO.txt
===================================================================
--- zope.generic/trunk/src/zope/generic/type/TODO.txt 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/type/TODO.txt 2006-04-18 10:22:53 UTC (rev 67076)
@@ -8,12 +8,12 @@
>>> foo = api.createObject(IFoo)
- >>> foo.__key_interface__ == IFoo
+ >>> foo.__keyface__ == IFoo
True
- >>> IKeyInterface(foo) == IFoo
+ >>> IKeyface(foo) == IFoo
True
>>> type_registration = IType(foo) # heute type_information
- >>> type_registration.__key_interface__ == IFoo
+ >>> type_registration.__keyface__ == IFoo
True
>>> type_registration.label
u'example.IFoo'
Modified: zope.generic/trunk/src/zope/generic/type/adapter.py
===================================================================
--- zope.generic/trunk/src/zope/generic/type/adapter.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/type/adapter.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -51,8 +51,8 @@
config = queryTypeConfiguration(self.context, IInitializerConfiguration)
if config:
# store initialization data
- if config.interface:
- provideInformation(self.context, config.interface, kws)
+ if config.keyface:
+ provideInformation(self.context, config.keyface, kws)
# invoke initialization handler
Modified: zope.generic/trunk/src/zope/generic/type/base.py
===================================================================
--- zope.generic/trunk/src/zope/generic/type/base.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/type/base.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -42,17 +42,19 @@
implements(IDirectlyTyped, IAttributeConfigurable, IAttributeAnnotatable)
- def __init__(self, interface, *pos, **kws):
+ def __init__(self, __keyface__, *pos, **kws):
super(Object, self).__init__()
- self.__dict__['interface'] = interface
- updateDirectlyProvided(self, interface)
+ self.__dict__['__keyface__'] = __keyface__
+ updateDirectlyProvided(self, __keyface__)
initializer = IInitializer(self, None)
if initializer:
initializer(*pos, **kws)
- provides('interface')
+ provides('__keyface__')
- interface = UpdateProvides(IDirectlyTyped['interface'])
+ __keyface__ = UpdateProvides(IDirectlyTyped['__keyface__'])
+
+ keyface = __keyface__
@@ -61,18 +63,19 @@
implements(IDirectlyTyped, IAttributeConfigurable, IAttributeAnnotatable)
- def __init__(self, interface, *pos, **kws):
+ def __init__(self, __keyface__, *pos, **kws):
super(Contained, self).__init__()
- self.__dict__['interface'] = interface
- updateDirectlyProvided(self, interface)
+ self.__dict__['__keyface__'] = __keyface__
+ updateDirectlyProvided(self, __keyface__)
initializer = IInitializer(self, None)
if initializer:
initializer(*pos, **kws)
- provides('interface')
+ provides('__keyface__')
- interface = UpdateProvides(IDirectlyTyped['interface'])
+ __keyface__ = UpdateProvides(IDirectlyTyped['__keyface__'])
+ keyface = __keyface__
class Container(btree.BTreeContainer):
@@ -80,18 +83,19 @@
implements(IDirectlyTyped, IAttributeConfigurable, IAttributeAnnotatable)
- def __init__(self, interface, *pos, **kws):
+ def __init__(self, __keyface__, *pos, **kws):
super(Container, self).__init__()
- self.__dict__['interface'] = interface
- updateDirectlyProvided(self, interface)
+ self.__dict__['__keyface__'] = __keyface__
+ updateDirectlyProvided(self, __keyface__)
initializer = IInitializer(self, None)
if initializer:
initializer(*pos, **kws)
- provides('interface')
+ provides('__keyface__')
- interface = UpdateProvides(IDirectlyTyped['interface'])
+ __keyface__ = UpdateProvides(IDirectlyTyped['__keyface__'])
+ keyface = __keyface__
class Folder(folder.Folder):
@@ -99,14 +103,16 @@
implements(IDirectlyTyped, IAttributeConfigurable, IAttributeAnnotatable)
- def __init__(self, interface, *pos, **kws):
+ def __init__(self, __keyface__, *pos, **kws):
super(Folder, self).__init__()
- self.__dict__['interface'] = interface
- updateDirectlyProvided(self, interface)
+ self.__dict__['__keyface__'] = __keyface__
+ updateDirectlyProvided(self, __keyface__)
initializer = IInitializer(self, None)
if initializer:
initializer(*pos, **kws)
- provides('interface')
+ provides('__keyface__')
- interface = UpdateProvides(IDirectlyTyped['interface'])
+ __keyface__ = UpdateProvides(IDirectlyTyped['__keyface__'])
+
+ keyface = __keyface__
Modified: zope.generic/trunk/src/zope/generic/type/configure.zcml
===================================================================
--- zope.generic/trunk/src/zope/generic/type/configure.zcml 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/type/configure.zcml 2006-04-18 10:22:53 UTC (rev 67076)
@@ -4,9 +4,64 @@
i18n_domain="zope">
<generic:informationProvider
- interface="zope.generic.component.IInformationProviderInformation"
+ keyface="zope.generic.component.IInformationProviderInformation"
label="Type Information Registry"
registry=".ITypeInformation"
/>
+ <!-- transient generic object implementation -->
+ <class class=".base.Object">
+ <require
+ permission="zope.Public"
+ interface="zope.generic.type.ITyped"
+ />
+ </class>
+
+ <!-- persistent generic contained implementation -->
+ <class class=".base.Contained">
+ <require
+ permission="zope.Public"
+ interface="zope.generic.type.ITyped"
+ />
+ </class>
+
+ <!-- persistent generic container implementation -->
+ <class class=".base.Container">
+ <require
+ permission="zope.Public"
+ interface="zope.generic.type.ITyped"
+ />
+ <require
+ permission="zope.View"
+ interface="zope.app.container.interfaces.IReadContainer"
+ />
+ <require
+ permission="zope.ManageContent"
+ interface="zope.app.container.interfaces.IWriteContainer"
+ />
+ </class>
+
+ <!-- persistent generic folder implementation -->
+ <class class=".base.Folder">
+ <require
+ permission="zope.Public"
+ interface="zope.generic.type.ITyped"
+ />
+ <require
+ permission="zope.View"
+ interface="zope.app.container.interfaces.IReadContainer"
+ />
+ <require
+ permission="zope.ManageContent"
+ interface="zope.app.container.interfaces.IWriteContainer"
+ />
+ <allow
+ attributes="getSiteManager"
+ />
+ <require
+ permission="zope.ManageSite"
+ attributes="setSiteManager"
+ />
+ </class>
+
</configure>
Modified: zope.generic/trunk/src/zope/generic/type/factory.py
===================================================================
--- zope.generic/trunk/src/zope/generic/type/factory.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/type/factory.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -33,7 +33,7 @@
class TypeFactory(Factory):
"""Type factory implementation.
- Preset the type interface for generic directly typed implementation
+ Preset the type keyface for generic directly typed implementation
of its __init__ method.
The type factory constructs directly typed objects of a given generic
@@ -52,7 +52,7 @@
Afterward we build a generic implementation implementing ITyped or a
regular typeable class:
- >>> from zope.generic.type import ITyped
+ >>> from zope.generic.type import IDirectlyTyped
>>> from zope.generic.directlyprovides.api import provides
>>> from zope.generic.directlyprovides.api import UpdateProvides
>>> from zope.generic.directlyprovides.api import updateDirectlyProvided
@@ -60,13 +60,14 @@
>>> class Object(object):
... implements(IDirectlyTyped)
...
- ... def __init__(self, interface, **kws):
+ ... def __init__(self, __keyface__, **kws):
... super(Object, self).__init__()
- ... self.__dict__['interface'] = interface
- ... updateDirectlyProvided(self, interface)
+ ... self.__dict__['__keyface__'] = __keyface__
+ ... updateDirectlyProvided(self, __keyface__)
...
- ... provides('interface')
- ... interface = UpdateProvides(ITyped['interface'])
+ ... provides('__keyface__')
+ ... __keyface__ = UpdateProvides(IDirectlyTyped['__keyface__'])
+ ... keyface = __keyface__
>>> class Foo(object):
... implements(ITypeable)
@@ -93,22 +94,22 @@
implements(IFactory)
- def __init__(self, callable, interface):
+ def __init__(self, callable, __keyface__):
# preconditions
if not ITypeable.implementedBy(callable):
raise ValueError('Callable must implement %s.' % ITypeable.__name__)
- if not ITypeType.providedBy(interface):
+ if not ITypeType.providedBy(__keyface__):
raise ValueError('Interface must provide %s.' % ITypeType.__name__)
- super(TypeFactory, self).__init__(callable, title='', description='', interfaces=(interface,))
+ super(TypeFactory, self).__init__(callable, title='', description='', interfaces=(__keyface__,))
# essentials
- self._interface = interface
+ self.__keyface__ = __keyface__
def __call__(self, *pos, **kws):
if IDirectlyTyped.implementedBy(self._callable):
- instance = self._callable(self._interface, *pos, **kws)
+ instance = self._callable(self.__keyface__, *pos, **kws)
else:
instance = self._callable(*pos, **kws)
Modified: zope.generic/trunk/src/zope/generic/type/helper.py
===================================================================
--- zope.generic/trunk/src/zope/generic/type/helper.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/type/helper.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -36,10 +36,10 @@
return component.createObject(toDottedName(interface), *pos, **kws)
-def createParameter(interface):
- config = queryTypeConfiguration(interface, IInitializerConfiguration)
+def createParameter(keyface):
+ config = queryTypeConfiguration(keyface, IInitializerConfiguration)
if config:
- return config.interface
+ return config.keyface
else:
return None
@@ -47,18 +47,18 @@
def getType(object):
- """Evaluate relevant type marker interface of an object."""
+ """Evaluate relevant type marker keyface of an object."""
if ITypeType.providedBy(object):
- interface = object
+ keyface = object
elif ITyped.providedBy(object):
- interface = object.interface
+ keyface = object.keyface
else:
- interface = ITyped(object).interface
+ keyface = ITyped(object).keyface
- return interface
+ return keyface
@@ -100,7 +100,7 @@
def acquireTypeConfiguration(object, configuration, default=None):
try:
- interface = getType(object, default)
+ keyface = getType(object, default)
except:
return default
Modified: zope.generic/trunk/src/zope/generic/type/interfaces.py
===================================================================
--- zope.generic/trunk/src/zope/generic/type/interfaces.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/type/interfaces.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -25,7 +25,7 @@
from zope.schema import Bool
from zope.schema import Object
-from zope.generic.component import IKeyInterface
+from zope.generic.component import IKeyface
from zope.generic.component import IConfigurationType
from zope.generic.directlyprovides import IProvides
from zope.generic.component import IInformationProvider
@@ -51,26 +51,26 @@
-class ITyped(ITypeable, IKeyInterface):
+class ITyped(ITypeable, IKeyface):
"""Provid an information within the."""
- interface = Object(
- title=_('Interface'),
- description=_('Interface marker that references corresponding type informations.'),
+ keyface = Object(
+ title=_('Key interface'),
+ description=_('Key interface that references corresponding type informations.'),
required=True,
schema=ITypeType)
-class IDirectlyTyped(ITyped, IProvides, IKeyInterface):
+class IDirectlyTyped(ITyped, IProvides, IKeyface):
"""Directly provide the declared interface."""
- def __init__(interface, *pos, **kws):
- """Directly provide the type interface during the __init__ call."""
+ def __init__(__keyface__, *pos, **kws):
+ """Directly provide the key interface during the __init__ call."""
- interface = Object(
- title=_('Interface'),
- description=_('The declared interface must be directly provided too.'),
+ __keyface__ = Object(
+ title=_('Key interface'),
+ description=_('The declared key interface must be directly provided too.'),
required=True,
readonly=True,
schema=ITypeType)
@@ -109,7 +109,7 @@
If the **kws does not satify the interface a KeyError is raised.
"""
- interface = Object(
+ keyface = Object(
title=_('Configuration interface'),
description=_('Configuration interface defining the signature.'),
required=False,
Modified: zope.generic/trunk/src/zope/generic/type/metaconfigure.py
===================================================================
--- zope.generic/trunk/src/zope/generic/type/metaconfigure.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/type/metaconfigure.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -45,10 +45,10 @@
-def provideTypeConfiguration(interface, configuration, data):
+def provideTypeConfiguration(keyface, configuration, data):
"""Set configuration data into the context."""
- info = queryTypeInformation(interface)
+ info = queryTypeInformation(keyface)
provideInformation(info, configuration, data)
@@ -85,30 +85,30 @@
_information_type = ITypeType
- def __init__(self, _context, interface, class_, label=None, hint=None):
+ def __init__(self, _context, keyface, class_, label=None, hint=None):
# preconditions
if isinstance(class_, ModuleType):
raise ConfigurationError('Implementation attribute must be a class')
# register types within the type information registry
registry = ITypeInformation
- super(TypeDirective, self).__init__(_context, interface, registry, label, hint)
+ super(TypeDirective, self).__init__(_context, keyface, registry, label, hint)
# create and proxy type factory
- factory = TypeFactory(class_, self._interface)
+ factory = TypeFactory(class_, self._keyface)
component = proxify(factory, InterfaceChecker(IFactory, CheckerPublic))
_context.action(
- discriminator = ('provideUtility', self._interface),
+ discriminator = ('provideUtility', self._keyface),
callable = provideUtility,
- args = (component, IFactory, toDottedName(self._interface)),
+ args = (component, IFactory, toDottedName(self._keyface)),
)
- def initializer(self, _context, interface=None, handler=None):
+ def initializer(self, _context, keyface=None, handler=None):
"""Add initializer."""
# preconditions
- if interface is None and handler is None:
- raise ConfigurationError('Attribute interface or handler must be defined')
+ if keyface is None and handler is None:
+ raise ConfigurationError('Attribute keyface or handler must be defined')
data = {}
if handler is not None:
@@ -117,14 +117,14 @@
data['handler'] = handler
- if interface is not None:
- data['interface'] = interface
+ if keyface is not None:
+ data['keyface'] = keyface
- adapter(self._context, [Initializer], None, [self._interface], None, '', True, False)
+ adapter(self._context, [Initializer], None, [self._keyface], None, '', True, False)
_context.action(
discriminator = (
- 'initializer', self._interface),
+ 'initializer', self._keyface),
callable = provideTypeConfiguration,
- args = (self._interface, IInitializerConfiguration, data),
+ args = (self._keyface, IInitializerConfiguration, data),
)
Modified: zope.generic/trunk/src/zope/generic/type/metadirectives.py
===================================================================
--- zope.generic/trunk/src/zope/generic/type/metadirectives.py 2006-04-17 19:25:20 UTC (rev 67075)
+++ zope.generic/trunk/src/zope/generic/type/metadirectives.py 2006-04-18 10:22:53 UTC (rev 67076)
@@ -45,9 +45,9 @@
class IInitializerSubdirective(Interface):
"""Provide an initializer configuration for the type."""
- interface = GlobalInterface(
- title=_('Configuration interface'),
- description=_('Configuration interface defining the signature.'),
+ keyface = GlobalInterface(
+ title=_('Configuration keyface'),
+ description=_('Configuration keyface defining the signature.'),
required=False
)
More information about the Checkins
mailing list